From 27995ca643deec75feb36aca3b91344b8b588002 Mon Sep 17 00:00:00 2001 From: rubygeek Date: Tue, 17 Sep 2019 13:41:52 -0500 Subject: [PATCH 1/2] divorced the example files from those used in testing, so we can not worry about breaking tests when we update example files --- .gitignore | 2 +- {example_data => test/naga/data}/in.json | 0 {example_data => test/naga/data}/in.schema | 0 test/naga/data/json-family.lg | 9 +++++++++ test/naga/test_integration.clj | 5 ++--- test/tmp/.gitkeep | 0 6 files changed, 12 insertions(+), 4 deletions(-) rename {example_data => test/naga/data}/in.json (100%) rename {example_data => test/naga/data}/in.schema (100%) create mode 100644 test/naga/data/json-family.lg create mode 100644 test/tmp/.gitkeep diff --git a/.gitignore b/.gitignore index 8a61590..f2db856 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,4 @@ pom.xml.asc .hgignore .hg/ .eastwood -example_data/out.json \ No newline at end of file +test/tmp/out.jso \ No newline at end of file diff --git a/example_data/in.json b/test/naga/data/in.json similarity index 100% rename from example_data/in.json rename to test/naga/data/in.json diff --git a/example_data/in.schema b/test/naga/data/in.schema similarity index 100% rename from example_data/in.schema rename to test/naga/data/in.schema diff --git a/test/naga/data/json-family.lg b/test/naga/data/json-family.lg new file mode 100644 index 0000000..8782673 --- /dev/null +++ b/test/naga/data/json-family.lg @@ -0,0 +1,9 @@ +jn:SymmetricProperty(sibling). + +parent(B,Cid) :- sibling(A,Bid), id(B,Bid), parent(A,Cid), id(C,Cid) . + +brother(A,Bid) :- sibling(A,Bid), id(B,Bid), type(B,"male") . + +uncle(A,Cid) :- parent(A,Bid), id(B,Bid), brother(B,Cid). + +P(B,Aid) :- P(A,Bid), id(A,Aid), id(B,Bid), jn:SymmetricProperty(P). diff --git a/test/naga/test_integration.clj b/test/naga/test_integration.clj index 75b1d24..f9285bb 100644 --- a/test/naga/test_integration.clj +++ b/test/naga/test_integration.clj @@ -38,9 +38,8 @@ {:id "mary", :sibling "george", :brother "george"}]) (deftest test-json-flow - (let [[out err] (capture-output -main "--json example_data/in.json --out example_data/out.json example_data/json-family.lg") - json-result (json/parse-string (slurp "example_data/out.json") keyword)] - + (let [[out err] (capture-output -main "--json test/naga/data/in.json --out test/tmp/out.json test/naga/data/json-family.lg") + json-result (json/parse-string (slurp "test/tmp/out.json") keyword)] (is (empty? out)) (is (empty? err)) (is (= (sort-by :id json-result) json-out)))) diff --git a/test/tmp/.gitkeep b/test/tmp/.gitkeep new file mode 100644 index 0000000..e69de29 From de73cd4caa69b44972de1231c6e2f440040f26b2 Mon Sep 17 00:00:00 2001 From: rubygeek Date: Tue, 17 Sep 2019 13:44:01 -0500 Subject: [PATCH 2/2] ignore tmp dir in tests for git --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f2db856..cb7b442 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,4 @@ pom.xml.asc .hgignore .hg/ .eastwood -test/tmp/out.jso \ No newline at end of file +test/tmp/* \ No newline at end of file