sydtest-aeson 0.1.0.0 → 0.2.0.0
raw patch · 3 files changed
+31/−33 lines, 3 filesdep ~sydtestPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: sydtest
API changes (from Hackage documentation)
Files
- src/Test/Syd/Aeson.hs +16/−14
- sydtest-aeson.cabal +3/−5
- test/Test/Syd/AesonSpec.hs +12/−14
src/Test/Syd/Aeson.hs view
@@ -41,17 +41,18 @@ ensureDir (parent p) SB.writeFile (fromAbsFile p) $ LB.toStrict $ JSON.encodePretty value, goldenTestCompare = \actual expected ->- if actual == expected- then Nothing- else- Just- ( Context- ( textsNotEqualButShouldHaveBeenEqual- (TE.decodeUtf8 (LB.toStrict (JSON.encodePretty actual)))- (TE.decodeUtf8 (LB.toStrict (JSON.encodePretty expected)))- )- (goldenContext fp)- )+ pure $+ if actual == expected+ then Nothing+ else+ Just+ ( Context+ ( textsNotEqualButShouldHaveBeenEqual+ (TE.decodeUtf8 (LB.toStrict (JSON.encodePretty actual)))+ (TE.decodeUtf8 (LB.toStrict (JSON.encodePretty expected)))+ )+ (goldenContext fp)+ ) } -- | Test that the given 'JSON.Value' is the same as what we find in the given golden file.@@ -82,9 +83,10 @@ ensureDir (parent p) SB.writeFile (fromAbsFile p) $ LB.toStrict $ JSON.encodePretty value, goldenTestCompare = \actual expected ->- if actual == expected- then Nothing- else Just (Context (stringsNotEqualButShouldHaveBeenEqual (ppShow actual) (ppShow expected)) (goldenContext fp))+ pure $+ if actual == expected+ then Nothing+ else Just (Context (stringsNotEqualButShouldHaveBeenEqual (ppShow actual) (ppShow expected)) (goldenContext fp)) } -- | Test that the given 'JSON.Value' is the same as what we find in the given golden file.
sydtest-aeson.cabal view
@@ -1,13 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.7.+-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack------ hash: 146fca0f19cd3781f36f8b0224fcd12370fa9dc1506f8adbd22c3078a82992fd name: sydtest-aeson-version: 0.1.0.0+version: 0.2.0.0 synopsis: An aeson companion library for sydtest category: Testing homepage: https://github.com/NorfairKing/sydtest#readme@@ -44,7 +42,7 @@ , deepseq , path , path-io- , sydtest+ , sydtest >=0.17 , text default-language: Haskell2010
test/Test/Syd/AesonSpec.hs view
@@ -15,10 +15,8 @@ spec = do describe "pureGoldenJSONFile" $ do it "outputs this example the same as before" $- pureGoldenJSONFile- "test_resources/pure-example.json"- $ JSON.object- ["hello" .= ("world" :: Text), "a" .= (1 :: Int), "b" .= True]+ pureGoldenJSONFile "test_resources/pure-example.json" $+ JSON.object ["hello" .= ("world" :: Text), "a" .= (1 :: Int), "b" .= True] it "does not write an empty file if encoding fails" $ do let path = "test_resources/pure-example-exception.json"@@ -37,16 +35,16 @@ describe "goldenJSONFile" $ it "outputs this example the same as before" $- goldenJSONFile- "test_resources/example.json"- $ pure $ JSON.object ["hello" .= ("world" :: Text), "a" .= (1 :: Int), "b" .= True]+ goldenJSONFile "test_resources/example.json" $+ pure $+ JSON.object ["hello" .= ("world" :: Text), "a" .= (1 :: Int), "b" .= True] describe "pureGoldenJSONValueFile" $ do- it "outputs this example the same as before" $- pureGoldenJSONValueFile+ it "outputs this example the same as before"+ $ pureGoldenJSONValueFile "test_resources/pure-example-value.json"- $ JSON.object- ["hello" .= ("world" :: Text), "a" .= (1 :: Int), "b" .= True]+ $ JSON.object+ ["hello" .= ("world" :: Text), "a" .= (1 :: Int), "b" .= True] it "does not write an empty file if encoding fails" $ do let path = "test_resources/pure-example-value-exception.json"@@ -65,6 +63,6 @@ describe "goldenJSONValueFile" $ it "outputs this example the same as before" $- goldenJSONValueFile- "test_resources/example-value.json"- $ pure $ JSON.object ["hello" .= ("world" :: Text), "a" .= (1 :: Int), "b" .= True]+ goldenJSONValueFile "test_resources/example-value.json" $+ pure $+ JSON.object ["hello" .= ("world" :: Text), "a" .= (1 :: Int), "b" .= True]