Skip to content

test: add missing parse-level tests for ignore_comment edge cases#5160

Open
shub-gour wants to merge 1 commit into
nlohmann:developfrom
shub-gour:test/empty-array-regression
Open

test: add missing parse-level tests for ignore_comment edge cases#5160
shub-gour wants to merge 1 commit into
nlohmann:developfrom
shub-gour:test/empty-array-regression

Conversation

@shub-gour
Copy link
Copy Markdown

@shub-gour shub-gour commented May 8, 2026

Description

Add missing high-level parse tests for ignore_comment edge cases (issue #2330).

The existing test only covers consecutive // comments before an empty object.
These new sections cover:

  • // comment before an array
  • /* */ block comment before an object
  • trailing comment after a valid JSON value
  • ignore_comment=false correctly throws on comment input

Notes

Low-level lexer comment scanning is already tested in unit-class_lexer.cpp.
These tests cover the missing json::parse() level cases.

@nlohmann
Copy link
Copy Markdown
Owner

nlohmann commented May 8, 2026

These tests already exist.

@shub-gour
Copy link
Copy Markdown
Author

Thanks for the feedback! I'll find a genuinely uncovered
edge case and update the PR.

@shub-gour shub-gour closed this May 8, 2026
@shub-gour shub-gour reopened this May 10, 2026
@shub-gour
Copy link
Copy Markdown
Author

Updated the PR — replaced the previous tests with genuinely
uncovered edge cases for ignore_comment at the json::parse() level.

Copy link
Copy Markdown
Owner

@nlohmann nlohmann left a comment

Choose a reason for hiding this comment

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

Comments are ignored within the lexer, and this is covered by unit-class_lexer.cpp. You test the parser - this is not an edge case, but independent features.

Signed-off-by: Shubham <gour5888@gmail.com>
@shub-gour shub-gour force-pushed the test/empty-array-regression branch from c909985 to cde2ee5 Compare May 10, 2026 09:49
@shub-gour shub-gour changed the title test: add edge case tests for empty array and object serialization test: add missing parse-level tests for ignore_comment edge cases May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants