@@ -19,51 +19,51 @@ main = exitProperly $ runTestTT $ TestList
19
19
numberTests :: [Test ]
20
20
numberTests =
21
21
[ testCase " cleans number" $
22
- " 1234567890" @=? number " (123) 456-7890"
22
+ Just " 1234567890" @=? number " (123) 456-7890"
23
23
, testCase " cleans another number" $
24
- " 6125551212" @=? number " (612) 555-1212"
24
+ Just " 6125551212" @=? number " (612) 555-1212"
25
25
, testCase " cleans number with dots" $
26
- " 1234567890" @=? number " 123.456.7890"
26
+ Just " 1234567890" @=? number " 123.456.7890"
27
27
, testCase " cleans another number with dots" $
28
- " 9187654321" @=? number " 918.765.4321"
28
+ Just " 9187654321" @=? number " 918.765.4321"
29
29
, testCase " valid when 11 digits and first is 1" $
30
- " 2468013579" @=? number " 12468013579"
30
+ Just " 2468013579" @=? number " 12468013579"
31
31
, testCase " invalid when 11 digits" $
32
- " 0000000000 " @=? number " 21234567890"
32
+ Nothing @=? number " 21234567890"
33
33
, testCase " invalid when 9 digits" $
34
- " 0000000000 " @=? number " 123456789"
34
+ Nothing @=? number " 123456789"
35
35
, testCase " invalid when 12 digits" $
36
- " 0000000000 " @=? number " 123456789012"
36
+ Nothing @=? number " 123456789012"
37
37
, testCase " invalid when empty" $
38
- " 0000000000 " @=? number " "
38
+ Nothing @=? number " "
39
39
, testCase " invalid when no digits present" $
40
- " 0000000000 " @=? number " (-) "
40
+ Nothing @=? number " (-) "
41
41
, testCase " valid with leading characters" $
42
- " 2358132134" @=? number " my number is 235 813 2134"
42
+ Just " 2358132134" @=? number " my number is 235 813 2134"
43
43
, testCase " valid with trailing characters" $
44
- " 9876543210" @=? number " 987 654 3210 - bob"
44
+ Just " 9876543210" @=? number " 987 654 3210 - bob"
45
45
, testCase " valid amidst text and punctuation" $
46
- " 4158880000" @=? number " Here it is: 415-888-0000. Thanks!"
46
+ Just " 4158880000" @=? number " Here it is: 415-888-0000. Thanks!"
47
47
]
48
48
49
49
areaCodeTests :: [Test ]
50
50
areaCodeTests =
51
51
[ testCase " area code" $
52
- " 123" @=? areaCode " 1234567890"
52
+ Just " 123" @=? areaCode " 1234567890"
53
53
, testCase " area code with parentheses" $
54
- " 612" @=? areaCode " (612) 555-1212"
54
+ Just " 612" @=? areaCode " (612) 555-1212"
55
55
, testCase " area code with leading characters" $
56
- " 235" @=? areaCode " my number is 235 813 2134"
56
+ Just " 235" @=? areaCode " my number is 235 813 2134"
57
57
, testCase " invalid area code" $
58
- " 000 " @=? areaCode " (-) "
58
+ Nothing @=? areaCode " (-) "
59
59
]
60
60
61
61
prettyPrintTests :: [Test ]
62
62
prettyPrintTests =
63
63
[ testCase " pretty print" $
64
- " (123) 456-7890" @=? prettyPrint " 1234567890"
64
+ Just " (123) 456-7890" @=? prettyPrint " 1234567890"
65
65
, testCase " pretty print with full US phone number" $
66
- " (234) 567-8901" @=? prettyPrint " 12345678901"
66
+ Just " (234) 567-8901" @=? prettyPrint " 12345678901"
67
67
, testCase " pretty print amidst text and punctuation" $
68
- " (415) 888-0000" @=? prettyPrint " Here it is: 415-888-0000. Thanks!"
68
+ Just " (415) 888-0000" @=? prettyPrint " Here it is: 415-888-0000. Thanks!"
69
69
]
0 commit comments