]> hydra-www.ietfng.org Git - dyna2/commitdiff
Wire test/repl into Backend.Python.Selftest
authorNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Wed, 12 Jun 2013 17:34:21 +0000 (13:34 -0400)
committerNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Wed, 12 Jun 2013 17:34:21 +0000 (13:34 -0400)
While here, some related cleanups

.gitignore
Makefile
dyna.cabal
src/Dyna/Backend/Python/Selftest.hs
test/repl/aggregator-conflict
test/repl/retract-rule

index 26624b48ee53cba2f8fe0e95aa4a13d5516e5509..6629aa44bc841478ec4c00b36d22c165ce37bae6 100644 (file)
@@ -1,6 +1,7 @@
 *.hi
 *.o
 *.pyc
+*.swp
 
 dist/
 examples/*.d
@@ -10,3 +11,7 @@ examples/*.plan.py
 examples/*.out
 
 docs/sphinx/_build
+
+test/*/*.out
+
+libpeerconnection.log
index 398eb8c09fb98cf957acfbf0c7d286c8c273a01b..def8f9faf28e13fc5a95949a17bcd4b5b38c54fb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,7 @@ clean:
        rm -rf examples/*.dyna.*.plan  \
            examples/*.dyna.*.out \
            examples/*.dyna.d
+       rm -rf test/*/*.out
        rm -f tags TAGS
 veryclean: clean
        rm -rf dist
index 704e399a3760f8102de853b3e4923145bd4202f7..25dd11fb9efd63336b4d2c2ac0baf0a45a86921a 100644 (file)
@@ -14,9 +14,10 @@ Homepage:       http://www.dyna.org/
 Category:       Compilers/Interpreters
 Synopsis:       Interpreter for the Dyna language
 Description:    A weighted logic programming language for dynamic
-                programming and natural language processing. Features
-                include memoization, both forward- and backward-chaining,
-                and namespace modularity.
+                programming and natural language processing.
+                
+                -- Features include memoization, both forward- and
+                -- backward-chaining, and namespace modularity.
 
 source-repository head
     type: git
@@ -156,10 +157,11 @@ Test-suite dyna-selftests
                         tagged >= 0.4.4,
                         template-haskell,
                         test-framework >=0.6,
+                        test-framework-golden >= 1.1,
                         test-framework-hunit >=0.2,
+                        test-framework-program >= 1.1,
                         test-framework-quickcheck2 >=0.3,
                         test-framework-th >=0.2,
-                        test-framework-golden >= 1.1,
                         transformers >= 0.3,
                         trifecta >= 1.0,
                         unordered-containers>=0.2,
index 0581db06fb42b38ecb4cbe8c963007693f03e229..1f59c81e33bc27ad78f2516acf573fdadf0cd165 100644 (file)
@@ -4,6 +4,7 @@
 
 -- Header material                                                      {{{
 {-# LANGUAGE ImplicitParams #-}
+{-# LANGUAGE TemplateHaskell #-}
 module Dyna.Backend.Python.Selftest where
 
 import           Control.Exception (throw)
@@ -14,7 +15,9 @@ import           System.Exit (ExitCode(..))
 import           System.IO
 import           System.IO.Error
 import           System.Process
-import qualified Test.Framework                      as TF
+import           Test.Framework                      as TF
+import           Test.Framework.Providers.Program
+import           Test.Framework.TH
 import           Test.Golden
 
 ------------------------------------------------------------------------}}}
@@ -68,22 +71,24 @@ mkExample name =
           , "examples/"          ++ name ++ ".dyna.py.out"
           , "examples/expected/" ++ name ++ ".py.out")
 
-goldens :: TF.Test
-goldens = TF.testGroup "Python Backend End-To-End"
-                -- Sorted roughly by likelihood that all subsequent examples
-                -- will be broken. ;)
-          $ map mkExample [ "simple", "fib-limit", "dijkstra"
-                          , "papa2", "matrixops"
-                          ]
+-- Sorted roughly by likelihood that all subsequent examples
+-- will be broken. ;)
+test_End_To_End :: [Test]
+test_End_To_End = map mkExample
+  [ "simple", "fib-limit", "dijkstra", "papa2", "matrixops" ]
+
+test_REPL :: [Test]
+test_REPL = map (\n -> testProgramRuns n ("./test/repl/"++n) [])
+  [ "aggregator-conflict", "retract-rule" ]
 
 ------------------------------------------------------------------------}}}
 -- Harness toplevel                                                     {{{
 
 selftest :: TF.Test
-selftest = goldens
+selftest = $(testGroupGenerator)
 
 main :: IO ()
-main = TF.defaultMain [selftest]
+main = $(defaultMainGenerator)
 
 -- If you're running from within GHCi and just want to do something quickly,
 -- try
index 3fd4ee577e3d6506f46aa5f46c9aa346c6e2cbac..6b9b95a5ec8bbeddea5ddf0b961014b6d48a8cdd 100755 (executable)
@@ -4,4 +4,4 @@ echo -e "
 a += 1.
 a." |./dyna > $0.out
 
-colordiff $0.expect $0.out && echo pass
+diff $0.expect $0.out && echo pass
index e96b1c2d656dcfffe20eaf9216b79627967cebd6..cacff9abb2afc0c9f8786ed978a4e94bf21a8694 100755 (executable)
@@ -10,7 +10,7 @@ retract_rule 0
 retract_rule 1
 chart" |./dyna > $0.out
 
-colordiff $0.expect $0.out && echo pass
+diff $0.expect $0.out && echo pass
 
 # TODO: add test to make sure that rule retraction will clear errors.