From c4fe4159c173c5cd03227f1ca4404068974f984d Mon Sep 17 00:00:00 2001 From: Tyson Smith Date: Thu, 30 Apr 2026 17:06:05 -0700 Subject: [PATCH] feat(FTB): support AssertedCast error messages --- FTB/AssertionHelper.py | 4 ++++ FTB/tests/fixtures/assert_asserted_cast.txt | 1 + FTB/tests/test_AssertionHelper.py | 14 ++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 FTB/tests/fixtures/assert_asserted_cast.txt diff --git a/FTB/AssertionHelper.py b/FTB/AssertionHelper.py index df5e260e2..3876a796f 100644 --- a/FTB/AssertionHelper.py +++ b/FTB/AssertionHelper.py @@ -83,6 +83,10 @@ def getAssertion(output: list[str]) -> str | list[str] | None: endRegex = RE_V8_END lastLine = [line] haveFatalAssertion = True + elif line.startswith("AssertedCast error:"): + # Firefox AssertedCast error (mozilla/Casting.h) + lastLine = line + haveFatalAssertion = True elif "Assertion" in line and "failed" in line: # Firefox ANGLE assertion lastLine = line diff --git a/FTB/tests/fixtures/assert_asserted_cast.txt b/FTB/tests/fixtures/assert_asserted_cast.txt new file mode 100644 index 000000000..c79194160 --- /dev/null +++ b/FTB/tests/fixtures/assert_asserted_cast.txt @@ -0,0 +1 @@ +AssertedCast error: Cannot cast -32769 from int32_t to uint32_t: out of range diff --git a/FTB/tests/test_AssertionHelper.py b/FTB/tests/test_AssertionHelper.py index d4883f6ec..17e144ad2 100644 --- a/FTB/tests/test_AssertionHelper.py +++ b/FTB/tests/test_AssertionHelper.py @@ -266,6 +266,20 @@ def test_AssertionHelperTestCPPUnhandledException(): _check_regex_matches(err, sanitizedMsg) +def test_AssertionHelperTestAssertedCast(): + err = (FIXTURE_PATH / "assert_asserted_cast.txt").read_text().splitlines() + + sanitizedMsg = AssertionHelper.getSanitizedAssertionPattern( + AssertionHelper.getAssertion(err) + ) + expectedMsg = ( + r"AssertedCast error: Cannot cast -[0-9]{2,} from int[0-9]{2,}_t to " + r"uint[0-9]{2,}_t: out of range" + ) + assert sanitizedMsg == expectedMsg + _check_regex_matches(err, sanitizedMsg) + + def test_AssertionHelperTestRustPanic01(): err = (FIXTURE_PATH / "assert_rust_panic1.txt").read_text().splitlines() sanitizedMsg = AssertionHelper.getSanitizedAssertionPattern(