1
- module Test.Kore.OptionsParser
1
+ module Test.Kore.Options
2
2
( test_flags
3
3
, test_options
4
4
) where
@@ -12,63 +12,61 @@ import Data.Maybe
12
12
import Test.Tasty
13
13
import Test.Tasty.HUnit.Ext
14
14
15
- import Kore.OptionsParser
16
-
17
- import Options.Applicative
15
+ import Kore.Options
18
16
19
17
test_flags :: [TestTree ]
20
18
test_flags =
21
19
[ testGroup " print-definition"
22
20
[ testCase " default is False" $ do
23
- let flag_value = willPrintDefinition $ runParser commandLineParser
21
+ let flagValue = willPrintDefinition $ runParser parseKoreParserOptions
24
22
[" mock/path/to/def" ]
25
23
assertEqual " Expected print-definition to be False by default"
26
- False flag_value
24
+ False flagValue
27
25
, testCase " given explicitly is True" $ do
28
- let flag_value = willPrintDefinition $ runParser commandLineParser
26
+ let flagValue = willPrintDefinition $ runParser parseKoreParserOptions
29
27
[" mock/path/to/def" , " --print-definition" ]
30
28
assertEqual " Expected --print-definition to give True"
31
- True flag_value
29
+ True flagValue
32
30
, testCase " with `no` prefix is False" $ do
33
- let flag_value = willPrintDefinition $ runParser commandLineParser
31
+ let flagValue = willPrintDefinition $ runParser parseKoreParserOptions
34
32
[" mock/path/to/def" , " --no-print-definition" ]
35
33
assertEqual " Expected --no-print-definition to give False"
36
- False flag_value
34
+ False flagValue
37
35
]
38
36
, testGroup " print-pattern"
39
37
[ testCase " default is False" $ do
40
- let flag_value = willPrintPattern $ runParser commandLineParser
38
+ let flagValue = willPrintPattern $ runParser parseKoreParserOptions
41
39
[" mock/path/to/def" ]
42
40
assertEqual " Expected print-pattern to be False by default"
43
- False flag_value
41
+ False flagValue
44
42
, testCase " given explicitly is True" $ do
45
- let flag_value = willPrintPattern $ runParser commandLineParser
43
+ let flagValue = willPrintPattern $ runParser parseKoreParserOptions
46
44
[" mock/path/to/def" , " --print-pattern" ]
47
45
assertEqual " Expected --print-pattern to give True"
48
- True flag_value
46
+ True flagValue
49
47
, testCase " with `no` prefix is False" $ do
50
- let flag_value = willPrintPattern $ runParser commandLineParser
48
+ let flagValue = willPrintPattern $ runParser parseKoreParserOptions
51
49
[" mock/path/to/def" , " --no-print-pattern" ]
52
50
assertEqual " Expected --no-print-pattern to give False"
53
- False flag_value
51
+ False flagValue
54
52
]
55
53
]
56
54
57
55
test_options :: [TestTree ]
58
56
test_options =
59
57
[ testGroup " pattern and module must go together"
60
58
[ testCase " pattern only" $ do
61
- let result = runParser' commandLineParser
59
+ let result = runParser' parseKoreParserOptions
62
60
[" mock/path/to/def" , " --pattern" , " mock/path/to/pat" ]
63
61
assertBool " Expected passing only the pattern option to fail"
64
62
$ isNothing result
65
63
, testCase " module only" $ do
66
- let result = runParser' commandLineParser
64
+ let result = runParser' parseKoreParserOptions
67
65
[" mock/path/to/def" , " --module" , " mock_module" ]
68
66
assertBool " Expected passing only the module option to fail"
69
67
$ isNothing result
70
68
, testCase " pattern and module" $ do
71
- let result = runParser' commandLineParser
69
+ let result = runParser' parseKoreParserOptions
72
70
[" mock/path/to/def" , " --pattern" , " mock/path/to/pat"
73
71
, " --module" , " mock_module" ]
74
72
assertBool " Expected passing both pattern and module options to not fail"
0 commit comments