Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve #488 #489

Merged
merged 1 commit into from
Dec 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 6 additions & 8 deletions tests/UnitTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -605,18 +605,17 @@ unescapeString = do

-- JSONTestSuite

jsonTestSuiteTest :: FilePath -> L.ByteString -> Test
jsonTestSuiteTest path payload =
testCase fileName .
assertBool fileName $
case take 2 fileName of
jsonTestSuiteTest :: FilePath -> Test
jsonTestSuiteTest path = testCase fileName $ do
payload <- L.readFile path
let result = eitherDecode payload :: Either String Value
assertBool fileName $ case take 2 fileName of
"i_" -> isRight result
"n_" -> isLeft result
"y_" -> isRight result
_ -> isRight result -- test_transform tests have inconsistent names
where
fileName = takeFileName path
result = eitherDecode payload :: Either String Value

-- Build a collection of tests based on the current contents of the
-- JSONTestSuite test directories.
Expand All @@ -637,8 +636,7 @@ jsonTestSuite = do
let ok name = takeExtension name == ".json" &&
not (name `HashSet.member` blacklist)
return . map (dir </>) . filter ok $ entries
fmap (testGroup "JSONTestSuite") . forM testPaths $ \path ->
jsonTestSuiteTest path <$> L.readFile path
return $ testGroup "JSONTestSuite" $ map jsonTestSuiteTest testPaths

-- The set expected-to-be-failing JSONTestSuite tests.
-- Not all of these failures are genuine bugs.
Expand Down