Skip to content

unable to generate new golden result #60

@piq9117

Description

@piq9117

I did this change on the json example

diff --git a/examples/json/src/Json.hs b/examples/json/src/Json.hs
index db30868..0f55b64 100644
--- a/examples/json/src/Json.hs
+++ b/examples/json/src/Json.hs
@@ -18,7 +18,7 @@ data Country = Country
 instance ToJSON Country


-ecuador = Country "Ecuador" "America" 1
+ecuador = Country "Ecuador" "America Change" 1
 germany = Country "Germany" "Europe" 2
 japan = Country "Japan" "Asia" 4

Ran the test and as expected I get this result

JsonGolden
  encodeCountries
    encodes a group of Countries into a JSON bytestring  [✘]
      Files golden and actual not match

Failures:

  test/JsonGoldenSpec.hs:25:4:
  1) JsonGolden.encodeCountries encodes a group of Countries into a JSON bytestring
       expected: "[{\"cname\":\"Ecuador\",\"continent\":\"America\",\"ctag\":1},{\"cname\":\"Germany\",\"continent\":\"Europe\",\"ctag\":2},{\"cname\":\"Japan\",\"continent\":\"Asia\",\"ctag\":4}]"
        but got: "[{\"cname\":\"Ecuador\",\"continent\":\"America Change\",\"ctag\":1},{\"cname\":\"Germany\",\"continent\":\"Europe\",\"ctag\":2},{\"cname\":\"Japan\",\"continent\":\"Asia\",\"ctag\":4}]"

  To rerun use: --match "/JsonGolden/encodeCountries/encodes a group of Countries into a JSON bytestring /"

Randomized with seed 2045427810

Finished in 0.0024 seconds
1 example, 1 failure

So I ran stack exec hgold -- --update .otherGolden/ and I get this from stdout

Replacing golden with actual:
Finished!

However, when I ran the test again. I get the same failing result

JsonGolden
  encodeCountries
    encodes a group of Countries into a JSON bytestring  [✘]
      Files golden and actual not match

Failures:

  test/JsonGoldenSpec.hs:25:4:
  1) JsonGolden.encodeCountries encodes a group of Countries into a JSON bytestring
       expected: "[{\"cname\":\"Ecuador\",\"continent\":\"America\",\"ctag\":1},{\"cname\":\"Germany\",\"continent\":\"Europe\",\"ctag\":2},{\"cname\":\"Japan\",\"continent\":\"Asia\",\"ctag\":4}]"
        but got: "[{\"cname\":\"Ecuador\",\"continent\":\"America Change\",\"ctag\":1},{\"cname\":\"Germany\",\"continent\":\"Europe\",\"ctag\":2},{\"cname\":\"Japan\",\"continent\":\"Asia\",\"ctag\":4}]"

  To rerun use: --match "/JsonGolden/encodeCountries/encodes a group of Countries into a JSON bytestring /"

Randomized with seed 1668369998

Finished in 0.0025 seconds
1 example, 1 failure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions