Update BNF tests to expect trailing newlines in rule output - #116
Conversation
…cript Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
|
你需要修改tests使得他可以满足目前code的调整 而不是调整code @copilot |
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
Done. I've reverted the code changes and updated all test expectations to match the original BNF behavior. All 23 tests now pass in both Python and JavaScript. (commit 90ad60e) Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
pre-commit 需要过一下 @copilot |
There was a problem hiding this comment.
Pull request overview
This PR updates test expectations to align with the BNF parser's existing behavior where the parse() function outputs rules with trailing newlines. The changes correct test assertions rather than modifying the parser implementation, which maintains consistency with the underlying C++ library's design.
Key Changes
- Updated Python test expectations to include trailing
\nfor all rules with premises (15 test cases) - Updated JavaScript test expectations to include trailing
\nfor all rules with premises (15 test cases) - Axioms (rules without premises) remain unchanged as they follow a different code path
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
bnf/tests/test_parse_unparse.py |
Updated all test expectations in both parse and unparse test functions to include trailing newlines, matching the parser's actual output behavior |
bnf/tests/test_parse_unparse.mjs |
Updated all test expectations in both parse and unparse test functions to include trailing newlines, maintaining consistency with Python tests |
The changes are correct and consistent across both test files. The pattern correctly reflects the parser's behavior where visitRule() appends an empty string to results, producing a trailing newline when joined. For multiple rules, the three newlines between rules (\n\n\n) correctly represent the trailing newline from the first rule plus the two-newline separator.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
Update BNF tests to expect trailing newlines in rule output
Per reviewer feedback (@hzhangxyz), the BNF code should keep its original behavior (outputting trailing newlines for rules with premises), and the tests should be updated to expect this behavior.
Changes:
bnf/apyds_bnf/__init__.pyandbnf/atsds_bnf/index.mjs(restoredresult.append("")andresult.push(""))\nfor rules with premises\nfor rules with premisesSummary:
✅ Code reverted to original behavior (keeping trailing newline)
✅ All test expectations updated to match the actual output
✅ All 23 BNF tests pass in both Python and JavaScript
✅ No security issues detected
✅ All pre-commit checks pass
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.