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