Skip to content

Commit

Permalink
Add some more tests for allowed and disallowed chars.
Browse files Browse the repository at this point in the history
  • Loading branch information
magthe committed Aug 22, 2011
1 parent a8490c6 commit fbdc67a
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion tst/ReaderI.hs
Expand Up @@ -45,6 +45,11 @@ case_secParserDisallowedChars1 = let
actual = p2E secParser "sec" "[_foo]\n"
in expected @=? actual

case_secParserDisallowedChars2 = let
expected = Left "bad"
actual = p2E secParser "sec" "[foo.bar]\n"
in expected @=? actual

case_secParserDropSpace = let
expected = Right $ SectionL "foo"
actual = p2E secParser "sec" "[ \tfoo\t ]\n"
Expand All @@ -56,11 +61,36 @@ case_secParserDropTrailing = let
in expected @=? actual

-- {{{1 optLineParser
case_optLineParserBasic = let
case_optLineParserAllowedChars1 = let
expected = Right $ OptionL "foo" "bar"
actual = p2E optLineParser "optLine" "foo=bar\n"
in expected @=? actual

case_optLineParserAllowedChars2 = let
expected = Right $ OptionL "Foo" "bAr"
actual = p2E optLineParser "optLine" "Foo=bAr\n"
in expected @=? actual

case_optLineParserAllowedChars3 = let
expected = Right $ OptionL "foo@/foo-" "bar"
actual = p2E optLineParser "optLine" "foo@/foo-=bar\n"
in expected @=? actual

case_optLineParserDisallowedChars1 = let
expected = Left "bad"
actual = p2E optLineParser "optLine" "foo_=bar\n"
in expected @=? actual

case_optLineParserDisallowedChars2 = let
expected = Left "bad"
actual = p2E optLineParser "optLine" "foo666=bar\n"
in expected @=? actual

case_optLineParserDisallowedChars3 = let
expected = Left "bad"
actual = p2E optLineParser "optLine" "foo.bar=baz\n"
in expected @=? actual

case_optLineParserDropSpace = let
expected = Right $ OptionL "foo" "bar"
actual = p2E optLineParser "optLine" "foo\t \t=\t \t bar\n"
Expand Down

0 comments on commit fbdc67a

Please sign in to comment.