diff --git a/damp.ekeko.plugin.test/.classpath b/damp.ekeko.plugin.test/.classpath index b3fffe6..098194c 100644 --- a/damp.ekeko.plugin.test/.classpath +++ b/damp.ekeko.plugin.test/.classpath @@ -3,10 +3,5 @@ - - - - - diff --git a/damp.ekeko.plugin.test/META-INF/MANIFEST.MF b/damp.ekeko.plugin.test/META-INF/MANIFEST.MF index 1e051c8..ca404fe 100644 --- a/damp.ekeko.plugin.test/META-INF/MANIFEST.MF +++ b/damp.ekeko.plugin.test/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Tycho-compatible unit tests for Ekeko Bundle-SymbolicName: damp.ekeko.plugin.test Bundle-Version: 2.0.9.qualifier -Fragment-Host: damp.ekeko.plugin +Fragment-Host: damp.ekeko.plugin;bundle-version="2.0.9.qualifier" Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Require-Bundle: org.junit, org.eclipse.ui.ide, diff --git a/damp.ekeko.plugin.test/src/test/damp/EkekoTest.java b/damp.ekeko.plugin.test/src/test/damp/EkekoTest.java index 26459c7..b172cac 100644 --- a/damp.ekeko.plugin.test/src/test/damp/EkekoTest.java +++ b/damp.ekeko.plugin.test/src/test/damp/EkekoTest.java @@ -41,6 +41,13 @@ public void testEkekoJDTSuite() { } + @Test + public void testEkekoJDTPersistence() { + EkekoTestHelper.testClojureNamespace(myBundle,"test.damp.ekeko.persistence"); + } + + + diff --git a/damp.ekeko.plugin.test/src/test/damp/ekeko/persistence.clj b/damp.ekeko.plugin.test/src/test/damp/ekeko/persistence.clj new file mode 100644 index 0000000..482eb7f --- /dev/null +++ b/damp.ekeko.plugin.test/src/test/damp/ekeko/persistence.clj @@ -0,0 +1,70 @@ +(ns + ^{:doc "Test suite for persistence of JDT values." + :author "Coen De Roover"} + test.damp.ekeko.persistence + (:refer-clojure :exclude [== type declare record?]) + (:require [clojure.core.logic :exclude [is] :as l]) + (:require [test.damp [ekeko :as test]]) + (:require [damp.ekeko.jdt + [javaprojectmodel :as javaprojectmodel] + [astnode :as astnode] + ]) + (:import [org.eclipse.jdt.core.dom CompilationUnit]) + (:use clojure.test)) + + + + +;; Persisting JDT AST nodes +;; ------------------------ + +(deftest + ^{:doc "For all nodes compilation units cu, cu has to be persistable."} + persist-compilationunits + (let [cus + (mapcat (fn [jpm] (.getCompilationUnits jpm)) + (javaprojectmodel/java-project-models))] + (doseq [cu cus] + (let [serialized (astnode/astnode-as-persistent-string cu) + deserialized (astnode/astnode-from-persistent-string serialized)] + (is (instance? CompilationUnit deserialized)))))) + + + +;; Looking up AST nodes in project by identifier +;; --------------------------------------------- + +(deftest + ^{:doc "For all AST nodes returned by Ekeko, an equivalent AST node should be found in a workspace project."} + lookup-equivalent-nodes + (is (reduce (fn [sofar t] + (let [exp (first t) + expid (astnode/project-value-identifier exp) + equivalent (astnode/corresponding-project-value expid)] + (and sofar (= (str exp) (str equivalent))))) + (damp.ekeko/ekeko [?e ?key] (damp.ekeko.jdt.ast/ast ?key ?e))))) + +;; Test suite +;; ---------- + +(deftest + test-suite + (let [testproject "TestCase-JDT-CompositeVisitor"] + (test/against-project-named testproject false persist-compilationunits) + (test/against-project-named testproject false lookup-equivalent-nodes) + + ) + ) + +(defn + test-ns-hook + [] + (test/with-ekeko-disabled test-suite)) + + +(comment + ;;Example repl session + (run-tests) + ) + + diff --git a/damp.ekeko.plugin/EkekoPluginLauncher.launch b/damp.ekeko.plugin/EkekoPluginLauncher.launch index 8695a05..318647d 100644 --- a/damp.ekeko.plugin/EkekoPluginLauncher.launch +++ b/damp.ekeko.plugin/EkekoPluginLauncher.launch @@ -11,8 +11,7 @@ - - + @@ -170,8 +169,8 @@ - - + +