mirror of
https://github.com/ilyakooo0/optparse-applicative.git
synced 2024-11-22 22:18:13 +03:00
Add new test cases for optional pair of arguments
This commit is contained in:
parent
e34d4105c7
commit
0f2c15ac7e
@ -36,6 +36,8 @@ extra-source-files: CHANGELOG.md
|
||||
tests/helponemptysub.err.txt
|
||||
tests/formatting.err.txt
|
||||
tests/nested.err.txt
|
||||
tests/optional.err.txt
|
||||
tests/nested_optional.err.txt
|
||||
tests/subparsers.err.txt
|
||||
|
||||
homepage: https://github.com/pcapriotti/optparse-applicative
|
||||
|
7
tests/nested_optional.err.txt
Normal file
7
tests/nested_optional.err.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Usage: nested_optional --a A [--b0 B0 [--b1 B1]]
|
||||
|
||||
Available options:
|
||||
--a A value a
|
||||
--b0 B0 value b0
|
||||
--b1 B1 value b1
|
||||
-h,--help Show this help text
|
6
tests/optional.err.txt
Normal file
6
tests/optional.err.txt
Normal file
@ -0,0 +1,6 @@
|
||||
Usage: optional [--a A --b B]
|
||||
|
||||
Available options:
|
||||
--a A value a
|
||||
--b B value b
|
||||
-h,--help Show this help text
|
@ -146,6 +146,37 @@ prop_alt_help = once $
|
||||
i = info (p <**> helper) idm
|
||||
in checkHelpText "alt" i ["--help"]
|
||||
|
||||
prop_optional_help :: Property
|
||||
prop_optional_help = once $
|
||||
let p :: Parser (Maybe (String, String))
|
||||
p = optional ((,)
|
||||
<$> strOption ( long "a"
|
||||
<> metavar "A"
|
||||
<> help "value a" )
|
||||
<*> strOption ( long "b"
|
||||
<> metavar "B"
|
||||
<> help "value b" ) )
|
||||
i = info (p <**> helper) idm
|
||||
in checkHelpText "optional" i ["--help"]
|
||||
|
||||
prop_nested_optional_help :: Property
|
||||
prop_nested_optional_help = once $
|
||||
let p :: Parser (String, Maybe (String, Maybe String))
|
||||
p = (,) <$>
|
||||
(strOption ( long "a"
|
||||
<> metavar "A"
|
||||
<> help "value a" ) ) <*>
|
||||
(optional
|
||||
((,) <$>
|
||||
(strOption ( long "b0"
|
||||
<> metavar "B0"
|
||||
<> help "value b0" ) ) <*>
|
||||
(optional (strOption ( long "b1"
|
||||
<> metavar "B1"
|
||||
<> help "value b1" )))))
|
||||
i = info (p <**> helper) idm
|
||||
in checkHelpText "nested_optional" i ["--help"]
|
||||
|
||||
prop_nested_commands :: Property
|
||||
prop_nested_commands = once $
|
||||
let p3 :: Parser String
|
||||
|
Loading…
Reference in New Issue
Block a user