[Git][haskell-team/DHG_packages][master] aeson: Fix tests on 32-bit architectures

Ilias Tsitsimpis (@iliastsi) gitlab at salsa.debian.org
Sat Oct 21 14:47:03 BST 2023



Ilias Tsitsimpis pushed to branch master at Debian Haskell Group / DHG_packages


Commits:
1143528b by Ilias Tsitsimpis at 2023-10-21T16:34:06+03:00
aeson: Fix tests on 32-bit architectures

- - - - -


3 changed files:

- p/haskell-aeson/debian/changelog
- + p/haskell-aeson/debian/patches/fix-tests-32bit
- p/haskell-aeson/debian/patches/series


Changes:

=====================================
p/haskell-aeson/debian/changelog
=====================================
@@ -1,3 +1,9 @@
+haskell-aeson (2.1.2.1-5) unstable; urgency=medium
+
+  * Fix tests on 32bit architectures (Closes: #1053530)
+
+ -- Ilias Tsitsimpis <iliastsi at debian.org>  Sat, 21 Oct 2023 16:34:01 +0300
+
 haskell-aeson (2.1.2.1-4) unstable; urgency=medium
 
   * Backport upstream patch to fix compatibility with QuickCheck 2.14.3


=====================================
p/haskell-aeson/debian/patches/fix-tests-32bit
=====================================
@@ -0,0 +1,88 @@
+Description: Fix tests on 32bit systems
+  Revert commit f089cdbf5dc5b0e396dcad7497871297770d08a5.
+Bug: https://github.com/haskell/aeson/issues/1060
+
+Index: b/tests/JSONTestSuite.hs
+===================================================================
+--- a/tests/JSONTestSuite.hs
++++ b/tests/JSONTestSuite.hs
+@@ -22,69 +22,19 @@ import qualified Data.Aeson.Decoding.Byt
+ 
+ 
+ jsonTestSuiteTest :: FilePath -> TestTree
+-jsonTestSuiteTest path = case take 2 fileName of
+-    "n_"                                                -> negative
+-    "y_"                                                -> positive
+-    "i_" | fileName `HashSet.member` ignore_accepted    -> positive
+-         | otherwise                                    -> negative
+-    _    | fileName `HashSet.member` transform_rejected -> negative
+-         | otherwise                                    -> positive
++jsonTestSuiteTest path = testCase fileName $ do
++    payload <- L.readFile path
++    let result = eitherDecode payload :: Either String Value
++    assertBool (show result) $ case take 2 fileName of
++      "n_"                                                -> isLeft result
++      "y_"                                                -> isRight result
++      "i_" | fileName `HashSet.member` ignore_accepted    -> isRight result
++           | otherwise                                    -> isLeft result
++      _    | fileName `HashSet.member` transform_rejected -> isLeft result
++           | otherwise                                    -> isRight result -- test_transform tests have inconsistent names
+   where
+     fileName = takeFileName path
+ 
+-    diff ref new = ["diff", "-u", ref, new]
+-
+-    positive = testGroup fileName
+-        [ goldenVsStringDiff "decode" diff ("tests" </>  "JSONTestSuite" </> "results" </> fileName -<.> "txt") $ do
+-            payload <- B.readFile path
+-            let result = eitherDecodeStrict payload :: Either String Value
+-            assertBool (show result) (isRight result)
+-            return (LBS8.pack (show result ++ "\n"))
+-
+-        , goldenVsStringDiff "decode via tokens" diff ("tests" </>  "JSONTestSuite" </> "results" </> fileName -<.> "txt") $ do
+-            payload <- B.readFile path
+-            let result = D.eitherDecodeStrict payload :: Either String Value
+-            assertBool (show result) (isRight result)
+-            return (LBS8.pack (show result ++ "\n"))
+-
+-        , goldenVsStringDiff "tokens bs" diff ("tests" </>  "JSONTestSuite" </> "results" </> fileName -<.> "tok") $ do
+-            payload <- B.readFile path
+-            let result = D.bsToTokens payload
+-            return (LBS8.pack (unlines (showTokens (const []) result)))
+-
+-        , goldenVsStringDiff "tokens lbs" diff ("tests" </>  "JSONTestSuite" </> "results" </> fileName -<.> "tok") $ do
+-            payload <- L.readFile path
+-            let result = D.lbsToTokens payload
+-            return (LBS8.pack (unlines (showTokens (const []) result)))
+-
+-        ]
+-
+-    negative = testGroup fileName
+-        [ testCase "decode" $ do
+-            payload <- B.readFile path
+-
+-            let result1 = eitherDecodeStrict payload :: Either String Value
+-            assertBool ("decode:" ++ show result1) (isLeft result1)
+-
+-            let result2 = D.eitherDecodeStrict payload :: Either String Value
+-            assertBool ("strict:" ++ show result2) (isLeft result2)
+-
+-            payloadL <- L.readFile path
+-
+-            let result3 = D.eitherDecode payloadL :: Either String Value
+-            assertBool ("lazy:" ++ show result3) (isLeft result3)
+-
+-        , goldenVsStringDiff "tokens bs" diff ("tests" </>  "JSONTestSuite" </> "results" </> fileName -<.> "tok") $ do
+-            payload <- B.readFile path
+-            let result = D.bsToTokens payload
+-            return (LBS8.pack (unlines (showTokens (const []) result)))
+-
+-        , goldenVsStringDiff "tokens lbs" diff ("tests" </>  "JSONTestSuite" </> "results" </> fileName -<.> "tok") $ do
+-            payload <- L.readFile path
+-            let result = D.lbsToTokens payload
+-            return (LBS8.pack (unlines (showTokens (const []) result)))
+-
+-        ]
+ 
+ showTokens :: Show e => (k -> [String]) -> Tokens k e -> [String]
+ showTokens kont (TkLit l k)      = ("TkLit " ++ show l) : kont k


=====================================
p/haskell-aeson/debian/patches/series
=====================================
@@ -1,3 +1,4 @@
 no-generically
 newer-deps
 fix-quickcheck-2.14.3
+fix-tests-32bit



View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/1143528bbc8bb05e39ac640a3bf2e08ad40679d0

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/1143528bbc8bb05e39ac640a3bf2e08ad40679d0
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-commits/attachments/20231021/e492dc04/attachment-0001.htm>


More information about the Pkg-haskell-commits mailing list