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

JSON generation/round-trip is incomplete #5

Merged
merged 6 commits into from
Jul 21, 2024
Merged

Conversation

ronaldtse
Copy link
Contributor

The commit ee14813 adds a test for to_json/from_json JSON compare (normalized).

The errors are:

Genericode
  XML round-trip conversion
    with file CaseTypeCode.gc
      performs a round-trip conversion
    with file ChannelCode-2.3.gc
      performs a round-trip conversion
    with file CurrencyCode-2.3.gc
      performs a round-trip conversion
    with file UnitOfMeasureCode-2.3.gc
      performs a round-trip conversion
  JSON round-trip conversion
    with file CaseTypeCode.gcj
      performs a round-trip conversion (FAILED - 1)
    with file ChannelCode-2.3.gcj
      performs a round-trip conversion (FAILED - 2)
    with file CurrencyCode-2.3.gcj
      performs a round-trip conversion (FAILED - 3)
    with file UnitOfMeasureCode-2.3.gcj
      performs a round-trip conversion (FAILED - 4)

Failures:

  1) Genericode JSON round-trip conversion with file CaseTypeCode.gcj performs a round-trip conversion
     Failure/Error: expect(reparsed_to_test).to eq(original_to_test)
     
       expected: "{\"Annotation\":{\"http://example.org/namespace/genericode-appinfo\":{\"ConformanceTargets\":{\"http...n\"},{\"code\":\"civil\"},{\"code\":\"criminal\"},{\"code\":\"domestic\"},{\"code\":\"juvenile\"}]}"
            got: "{\"Annotation\":{\"Description\":[]},\"Identification\":{\"ShortName\":\"CaseTypeCode\",\"LongName\"...n\"},{\"code\":\"civil\"},{\"code\":\"criminal\"},{\"code\":\"domestic\"},{\"code\":\"juvenile\"}]}"
     
       (compared using ==)
     # ./spec/genericode_spec.rb:54:in `block (5 levels) in <top (required)>'

  2) Genericode JSON round-trip conversion with file ChannelCode-2.3.gcj performs a round-trip conversion
     Failure/Error: expect(reparsed_to_test).to eq(original_to_test)
     
       expected: "{\"Identification\":{\"ShortName\":\"ChannelCode\",\"LongName\":[{\"http://www.w3.org/XML/1998/names..."National telephone switchboard\",\"description\":\"The national telephone switchboard number.\"}]}"
            got: "{\"Identification\":{\"ShortName\":\"ChannelCode\",\"LongName\":[{\"_\":\"Channel Code\"},{\"_\":\"U..."National telephone switchboard\",\"description\":\"The national telephone switchboard number.\"}]}"
     
       (compared using ==)
     # ./spec/genericode_spec.rb:54:in `block (5 levels) in <top (required)>'

  3) Genericode JSON round-trip conversion with file CurrencyCode-2.3.gcj performs a round-trip conversion
     Failure/Error: expect(reparsed_to_test).to eq(original_to_test)
     
       expected: "{\"Identification\":{\"ShortName\":\"CurrencyCode\",\"LongName\":[{\"http://www.w3.org/XML/1998/name...:\"Zimbabwe Dollar\",\"numericcode\":\"932\",\"fractionaldigits\":\"2\",\"country\":\"ZIMBABWE\"}]}"
            got: "{\"Identification\":{\"ShortName\":\"CurrencyCode\",\"LongName\":[{\"_\":\"Currency Code\"},{\"_\":\...:\"Zimbabwe Dollar\",\"numericcode\":\"932\",\"fractionaldigits\":\"2\",\"country\":\"ZIMBABWE\"}]}"
     
       (compared using ==)
     # ./spec/genericode_spec.rb:54:in `block (5 levels) in <top (required)>'

  4) Genericode JSON round-trip conversion with file UnitOfMeasureCode-2.3.gcj performs a round-trip conversion
     Failure/Error: expect(reparsed_to_test).to eq(original_to_test)
     
       expected: "{\"Identification\":{\"ShortName\":\"UnitOfMeasureCode\",\"LongName\":[{\"http://www.w3.org/XML/1998...\"A unit of measure as agreed in common between two or more parties.\",\"levelcategory\":\"3.9\"}]}"
            got: "{\"Identification\":{\"ShortName\":\"UnitOfMeasureCode\",\"LongName\":[{\"_\":\"Unit Of Measure Code...\"A unit of measure as agreed in common between two or more parties.\",\"levelcategory\":\"3.9\"}]}"
     
       (compared using ==)
     # ./spec/genericode_spec.rb:54:in `block (5 levels) in <top (required)>'

Finished in 0.69108 seconds (files took 0.11418 seconds to load)
8 examples, 4 failures

Failed examples:

rspec ./spec/genericode_spec.rb[1:2:1:1] # Genericode JSON round-trip conversion with file CaseTypeCode.gcj performs a round-trip conversion
rspec ./spec/genericode_spec.rb[1:2:2:1] # Genericode JSON round-trip conversion with file ChannelCode-2.3.gcj performs a round-trip conversion
rspec ./spec/genericode_spec.rb[1:2:3:1] # Genericode JSON round-trip conversion with file CurrencyCode-2.3.gcj performs a round-trip conversion
rspec ./spec/genericode_spec.rb[1:2:4:1] # Genericode JSON round-trip conversion with file UnitOfMeasureCode-2.3.gcj performs a round-trip conversion

@ronaldtse ronaldtse added the bug Something isn't working label Jul 20, 2024
@ronaldtse
Copy link
Contributor Author

FYI @hasaniskandar .

@ronaldtse
Copy link
Contributor Author

I'm merging first.

@ronaldtse ronaldtse merged commit 9031e89 into main Jul 21, 2024
2 of 14 checks passed
@ronaldtse ronaldtse deleted the fix/json-parser branch July 21, 2024 09:20
@hasaniskandar
Copy link
Contributor

Ok @ronaldtse. I almost done, will create a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants