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(yaml): add parse() test for duplicate keys #5240

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

iuioiua
Copy link
Contributor

@iuioiua iuioiua commented Jul 2, 2024

Unblocks #5240

@iuioiua iuioiua requested a review from kt3k as a code owner July 2, 2024 03:17
@github-actions github-actions bot added the yaml label Jul 2, 2024
Copy link

codecov bot commented Jul 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.32%. Comparing base (cadf85c) to head (9c3e62a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5240      +/-   ##
==========================================
+ Coverage   95.30%   95.32%   +0.01%     
==========================================
  Files         460      460              
  Lines       38056    38056              
  Branches     5577     5580       +3     
==========================================
+ Hits        36269    36276       +7     
+ Misses       1745     1738       -7     
  Partials       42       42              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor Author

@iuioiua iuioiua Jul 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current documentation says that if ParseOptions.json is true, then duplicate keys cause parse() to throw, like JSON.parse(). But by default, ParseOptions.json is false, and duplicate keys still cause parse() to throw. In other words, ParseOptions.json currently does the exact opposite of what it should 😆

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON.parse() doesn't seem throwing with duplicated keys?

> JSON.parse('{"a":1,"a":2}')
{ a: 2 }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok - then my understanding of JSON.parse() was wrong 😆

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iuioiua iuioiua merged commit 9c9ed80 into main Jul 2, 2024
16 checks passed
@iuioiua iuioiua deleted the yaml-duplicate-key-test branch July 2, 2024 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants