kowainik / tomland

🏝 Bidirectional TOML serialization
https://kowainik.github.io/posts/2019-01-14-tomland
Mozilla Public License 2.0
120 stars 39 forks source link

Test failure in test/Test/Toml/Codec/Combinator/Common.hs:39:5 #400

Open roberth opened 2 years ago

roberth commented 2 years ago

Tomland version 1.3.3.1 can fail the test suite.

See https://hercules-ci.com/accounts/github/hercules-ci/derivations/%2Fnix%2Fstore%2F9d2d9x2493b8lj680qwpd6n42ppz7qa5-tomland-1.3.3.1.drv/log?via-job=8854a963-a984-497a-a080-b609e1db77e2

Platform: aarch64-darwin Nixpkgs revision: https://github.com/NixOS/nixpkgs/pull/163303 at https://github.com/NixOS/nixpkgs/pull/163303/commits/37ed97a969ab5a532ae6e971987edadbed619a80

Error message:

Failures:
  test/Test/Toml/Codec/Combinator/Common.hs:39:5: 
  1) Codec: unit and property tests for bidirectional codecs, Combinator spec, Combinator.Map: Roundtrip tests, Map Text [Int] (tableMap): decode . encode ≡ id
         ✗ <interactive> failed at test/Test/Toml/Codec/Combinator/Common.hs:39:5
           after 48 tests and 14 shrinks.

              ┏━━ test/Test/Toml/Codec/Combinator/Common.hs ━━━
           28 ┃ codecRoundtripWith
           29 ┃     :: forall a
           30 ┃     .  (Eq a, Show a)
           31 ┃     => (TomlCodec a -> Text -> Either [TomlDecodeError] a)
           32 ┃     -> String
           33 ┃     -> (Key -> TomlCodec a)
           34 ┃     -> Gen a
           35 ┃     -> SpecWith (Arg Expectation)
           36 ┃ codecRoundtripWith dcode typeName mkCodec genA = it label $ hedgehog $ do
           37 ┃     a <- forAll genA
              ┃     │ fromList [ ( "g_" , [ 0 ] ) , ( "g_.aa" , [ 0 ] ) ]
           38 ┃     let codec = mkCodec "a"
           39 ┃     tripping a (encode codec) (dcode codec)
              ┃     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              ┃     │ ━━━ Intermediate ━━━
              ┃     │ "\n[a]\n  [[a.g_]]\n    val = 0\n\n  [[a.g_.aa]]\n    val = 0\n"
              ┃     │ ━━━ - Original) (+ Roundtrip ━━━
              ┃     │ - Right (fromList [ ( "g_" , [ 0 ] ) , ( "g_.aa" , [ 0 ] ) ])
              ┃     │ + Right (fromList [ ( "g_" , [ 0 ] ) ])
           40 ┃   where
           41 ┃     label :: String
           42 ┃     label = typeName ++ ": decode . encode ≡ id"

           This failure can be reproduced by running:
           > recheck (Size 47) (Seed 4929322876260931616 8677625409372021739) <property>

It seems that #374 wasn't fixed completely.