-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindIdentifier_Test.hs
More file actions
28 lines (19 loc) · 851 Bytes
/
FindIdentifier_Test.hs
File metadata and controls
28 lines (19 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-- | Testing FindIdentifier
module FindIdentifier_Test where
import FindIdentifier( findIdentifier )
import Test.HUnit
borderCases = TestLabel "Border test cases" (TestList [
testEmpty, testNegCursor, testComment
] )
testEmpty = TestCase $ assertEqual
"Should get Nothing form an empty string" Nothing (findIdentifier "" (1,1))
testNegCursor = TestCase $ assertEqual
"Should get Nothing when cursor is nagative" Nothing (findIdentifier "a" (-1, -1))
testComment = TestCase $ assertEqual
"Should get Nothing on comment" Nothing (findIdentifier "-- a" (1,3))
simpleCases = TestLabel "Simple, but serious cases" ( TestList [
testMinimal
])
testMinimal = TestCase $ assertEqual
"Minimal program" (Just "main") (findIdentifier "main = print" (1,2))
main = runTestTT $ TestList[borderCases, simpleCases]