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

Test suite depends on unstable ordering returned from aeson #5

Open
sternenseemann opened this issue Dec 26, 2021 · 0 comments
Open

Comments

@sternenseemann
Copy link

Test failure should be reproducible with cabal v2-test --constraint 'unordered-containers >= 0.2.16, as that release changed ordering returned from HashMaps via toList, folds etc.

Running 1 test suites...
Test suite json-to-haskell-test: RUNNING...

analyze
  should build a record with all types FAILED [1]
  should share records definitions for identical subrecords FAILED [2]
  should pick good names for differing records which share field names FAILED [3]
  should pick the best name if there are multiple possible names but some conflict FAILED [4]
  should sanitize weird field and record names

Failures:

  test/Spec.hs:15:5: 
  1) analyze should build a record with all types
       expected: "data Model = Model\n  { modelA :: Double\n  , modelD :: Double\n  , modelB :: Text\n  , modelC :: [Maybe Value]\n  } deriving (Show, Eq, Ord)"
        but got: "data Model = Model\n  { modelB :: Text\n  , modelA :: Double\n  , modelD :: Double\n  , modelC :: [Maybe Value]\n  } deriving (Show, Eq, Ord)"

  To rerun use: --match "/analyze/should build a record with all types/"

  test/Spec.hs:15:5: 
  2) analyze should share records definitions for identical subrecords
       expected: "data A = A\n  { aAge :: Double\n  , aName :: Text\n  } deriving (Show, Eq, Ord)\n\ndata Model = Model\n  { modelA :: A\n  , modelB :: A\n  } deriving (Show, Eq, Ord)"
        but got: "data A = A\n  { aAge :: Double\n  , aName :: Text\n  } deriving (Show, Eq, Ord)\n\ndata Model = Model\n  { modelB :: A\n  , modelA :: A\n  } deriving (Show, Eq, Ord)"

  To rerun use: --match "/analyze/should share records definitions for identical subrecords/"

  test/Spec.hs:15:5: 
  3) analyze should pick good names for differing records which share field names
       expected: "data A = A\n  { aField :: Field\n  } deriving (Show, Eq, Ord)\n\ndata B = B\n  { bField :: Field2\n  } deriving (Show, Eq, Ord)\n\ndata Field = Field\n  { fieldName :: Text\n  } deriving (Show, Eq, Ord)\n\ndata Field2 = Field2\n  { field2Age :: Double\n  } deriving (Show, Eq, Ord)\n\ndata Model = Model\n  { modelA :: A\n  , modelB :: B\n  } deriving (Show, Eq, Ord)"
        but got: "data A = A\n  { aField :: Field\n  } deriving (Show, Eq, Ord)\n\ndata B = B\n  { bField :: Field2\n  } deriving (Show, Eq, Ord)\n\ndata Field = Field\n  { fieldName :: Text\n  } deriving (Show, Eq, Ord)\n\ndata Field2 = Field2\n  { field2Age :: Double\n  } deriving (Show, Eq, Ord)\n\ndata Model = Model\n  { modelB :: B\n  , modelA :: A\n  } deriving (Show, Eq, Ord)"

  To rerun use: --match "/analyze/should pick good names for differing records which share field names/"

  test/Spec.hs:15:5: 
  4) analyze should pick the best name if there are multiple possible names but some conflict
       expected: "data A = A\n  { aField :: Field\n  } deriving (Show, Eq, Ord)\n\ndata B = B\n  { bField :: Other\n  } deriving (Show, Eq, Ord)\n\ndata C = C\n  { cOther :: Other\n  } deriving (Show, Eq, Ord)\n\ndata Field = Field\n  { fieldName :: Text\n  } deriving (Show, Eq, Ord)\n\ndata Model = Model\n  { modelA :: A\n  , modelB :: B\n  , modelC :: C\n  } deriving (Show, Eq, Ord)\n\ndata Other = Other\n  { otherAge :: Double\n  } deriving (Show, Eq, Ord)"
        but got: "data A = A\n  { aField :: Field\n  } deriving (Show, Eq, Ord)\n\ndata B = B\n  { bField :: Other\n  } deriving (Show, Eq, Ord)\n\ndata C = C\n  { cOther :: Other\n  } deriving (Show, Eq, Ord)\n\ndata Field = Field\n  { fieldName :: Text\n  } deriving (Show, Eq, Ord)\n\ndata Model = Model\n  { modelB :: B\n  , modelA :: A\n  , modelC :: C\n  } deriving (Show, Eq, Ord)\n\ndata Other = Other\n  { otherAge :: Double\n  } deriving (Show, Eq, Ord)"

  To rerun use: --match "/analyze/should pick the best name if there are multiple possible names but some conflict/"

Randomized with seed 1870694535

Finished in 0.0341 seconds
5 examples, 4 failures
Test suite json-to-haskell-test: FAIL
Test suite logged to:
dist/test/json-to-haskell-0.1.1.2-json-to-haskell-test.log
0 of 1 test suites (0 of 1 test cases) passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant