summaryrefslogtreecommitdiff
path: root/Command-test.hs
blob: bf2b6fcb437a4c316bd9decea1994b6e35334e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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]