masaori335 commented on code in PR #13656:
URL: https://github.com/apache/trafficserver/pull/13656#discussion_r3975688585
##########
tools/hrw4u/tests/test_cli.py:
##########
@@ -244,3 +244,53 @@ def test_cli_help_lists_error_format_flag() -> None:
assert "--error-format" in result.stdout
for choice in ("plain", "json", "markdown"):
assert choice in result.stdout
+
+
+#
+# Exit-code contract: a compile error must fail the build.
+#
+
+
+def test_cli_exits_nonzero_on_syntax_error(tmp_path: Path) -> None:
+ """A syntax error must exit non-zero even though ANTLR recovers and yields
a tree."""
+ bad = tmp_path / "bad.hrw4u"
+ bad.write_text("REMAP {\n inbound.req.X-Foo = \n}\n")
+
+ result = run_hrw4u([str(bad)])
+
+ assert result.returncode != 0
+ assert ": error:" in result.stderr
Review Comment:
I'd reject this suggestion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]