summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2012-05-22 09:48:02 +1000
committerJed Barber <jjbarber@y7mail.com>2012-05-22 09:48:02 +1000
commitf8261525ddb9efe70eef21d3fc45003f431826e7 (patch)
tree0c8599752a1036a3b053745a05537d85326898f1
parent3ea6bacad9fd7b14d5454d6ea109f5de724fd690 (diff)
First few test cases
-rw-r--r--Command-test.hs23
1 files changed, 23 insertions, 0 deletions
diff --git a/Command-test.hs b/Command-test.hs
new file mode 100644
index 0000000..bf2b6fc
--- /dev/null
+++ b/Command-test.hs
@@ -0,0 +1,23 @@
+import Test.HUnit
+import Command
+import TypeVar
+
+
+nametest1 = TestCase (assertEqual "for (name \"abc\")"
+ (Just (Name [] "abc"))
+ (name "\"abc\""))
+
+nametest2 = TestCase (assertEqual "for (name \"first.second.third\")"
+ (Just (Name ["first","second"] "third"))
+ (name "\"first.second.third\""))
+
+nametest3 = TestCase (assertEqual "for (name \"firs\\t.se\\cond.\\t\\h\\ird\")"
+ (Just (Name ["first","second"] "third"))
+ (name "\"firs\\t.se\\cond.\\t\\h\\ird\""))
+
+nametest4 = TestCase (assertEqual "for (name abc)"
+ Nothing
+ (name "abc"))
+
+main =
+ runTestTT $ TestList [nametest1,nametest2,nametest3,nametest4]