Skip to content

Commit

Permalink
Merge pull request #489 from phadej/issue-488
Browse files Browse the repository at this point in the history
Resolve #488
  • Loading branch information
bergmark committed Dec 12, 2016
2 parents 38af5f3 + 5f5d81b commit 66a5b73
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tests/UnitTests.hs
Expand Up @@ -609,18 +609,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 @@ -641,8 +640,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

0 comments on commit 66a5b73

Please sign in to comment.