Make the comma after assert warn/fail/fatal optional (#2160)

Co-authored-by: Eldred Habert <[email protected]>
This commit is contained in:
RangiandEldred Habert authored and GitHub committed 2026-09-26 19:55:35 +02:00
1 parent e8422c1c88
commit f1e530ac39
5 files changed
+101 -7

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
def n = 0
for i_type, 5
redef type equs strslice(" warn fail warn,fail,", i_type * 5, (i_type + 1) * 5)
for i_message, 2
redef message equs ", \"hello {d:n}\""
redef message equs strslice(#message, 0, i_message * strlen(#message))
for cond, 2
redef line equs "assert {type} {cond} {message}"
println "[static_]{line}"
{line}
static_{line}
def n += 1
endr
endr
endr
println "[static_]assert fatal..."
assert fatal 1
assert fatal 1, "goodbye 0"
static_assert fatal 1
static_assert fatal 1, "goodbye 0"
assert fatal 0
assert fatal 0, "goodbye 1" ; not reached
+42
View File
@@ -0,0 +1,42 @@
error: Assertion failed
at assert-comma.asm::REPT~1::REPT~1::REPT~1(10) <- assert-comma.asm::REPT~1::REPT~1(7) <- assert-comma.asm::REPT~1(4) <- assert-comma.asm(2)
error: Assertion failed
at assert-comma.asm::REPT~1::REPT~1::REPT~1(11) <- assert-comma.asm::REPT~1::REPT~1(7) <- assert-comma.asm::REPT~1(4) <- assert-comma.asm(2)
error: Assertion failed: hello 2
at assert-comma.asm::REPT~1::REPT~2::REPT~1(10) <- assert-comma.asm::REPT~1::REPT~2(7) <- assert-comma.asm::REPT~1(4) <- assert-comma.asm(2)
error: Assertion failed: hello 2
at assert-comma.asm::REPT~1::REPT~2::REPT~1(11) <- assert-comma.asm::REPT~1::REPT~2(7) <- assert-comma.asm::REPT~1(4) <- assert-comma.asm(2)
warning: Assertion failed [-Wassert]
at assert-comma.asm::REPT~2::REPT~1::REPT~1(10) <- assert-comma.asm::REPT~2::REPT~1(7) <- assert-comma.asm::REPT~2(4) <- assert-comma.asm(2)
warning: Assertion failed [-Wassert]
at assert-comma.asm::REPT~2::REPT~1::REPT~1(11) <- assert-comma.asm::REPT~2::REPT~1(7) <- assert-comma.asm::REPT~2(4) <- assert-comma.asm(2)
warning: Assertion failed: hello 6 [-Wassert]
at assert-comma.asm::REPT~2::REPT~2::REPT~1(10) <- assert-comma.asm::REPT~2::REPT~2(7) <- assert-comma.asm::REPT~2(4) <- assert-comma.asm(2)
warning: Assertion failed: hello 6 [-Wassert]
at assert-comma.asm::REPT~2::REPT~2::REPT~1(11) <- assert-comma.asm::REPT~2::REPT~2(7) <- assert-comma.asm::REPT~2(4) <- assert-comma.asm(2)
error: Assertion failed
at assert-comma.asm::REPT~3::REPT~1::REPT~1(10) <- assert-comma.asm::REPT~3::REPT~1(7) <- assert-comma.asm::REPT~3(4) <- assert-comma.asm(2)
error: Assertion failed
at assert-comma.asm::REPT~3::REPT~1::REPT~1(11) <- assert-comma.asm::REPT~3::REPT~1(7) <- assert-comma.asm::REPT~3(4) <- assert-comma.asm(2)
error: Assertion failed: hello 10
at assert-comma.asm::REPT~3::REPT~2::REPT~1(10) <- assert-comma.asm::REPT~3::REPT~2(7) <- assert-comma.asm::REPT~3(4) <- assert-comma.asm(2)
error: Assertion failed: hello 10
at assert-comma.asm::REPT~3::REPT~2::REPT~1(11) <- assert-comma.asm::REPT~3::REPT~2(7) <- assert-comma.asm::REPT~3(4) <- assert-comma.asm(2)
warning: Assertion failed [-Wassert]
at assert-comma.asm::REPT~4::REPT~1::REPT~1(10) <- assert-comma.asm::REPT~4::REPT~1(7) <- assert-comma.asm::REPT~4(4) <- assert-comma.asm(2)
warning: Assertion failed [-Wassert]
at assert-comma.asm::REPT~4::REPT~1::REPT~1(11) <- assert-comma.asm::REPT~4::REPT~1(7) <- assert-comma.asm::REPT~4(4) <- assert-comma.asm(2)
warning: Assertion failed: hello 14 [-Wassert]
at assert-comma.asm::REPT~4::REPT~2::REPT~1(10) <- assert-comma.asm::REPT~4::REPT~2(7) <- assert-comma.asm::REPT~4(4) <- assert-comma.asm(2)
warning: Assertion failed: hello 14 [-Wassert]
at assert-comma.asm::REPT~4::REPT~2::REPT~1(11) <- assert-comma.asm::REPT~4::REPT~2(7) <- assert-comma.asm::REPT~4(4) <- assert-comma.asm(2)
error: Assertion failed
at assert-comma.asm::REPT~5::REPT~1::REPT~1(10) <- assert-comma.asm::REPT~5::REPT~1(7) <- assert-comma.asm::REPT~5(4) <- assert-comma.asm(2)
error: Assertion failed
at assert-comma.asm::REPT~5::REPT~1::REPT~1(11) <- assert-comma.asm::REPT~5::REPT~1(7) <- assert-comma.asm::REPT~5(4) <- assert-comma.asm(2)
error: Assertion failed: hello 18
at assert-comma.asm::REPT~5::REPT~2::REPT~1(10) <- assert-comma.asm::REPT~5::REPT~2(7) <- assert-comma.asm::REPT~5(4) <- assert-comma.asm(2)
error: Assertion failed: hello 18
at assert-comma.asm::REPT~5::REPT~2::REPT~1(11) <- assert-comma.asm::REPT~5::REPT~2(7) <- assert-comma.asm::REPT~5(4) <- assert-comma.asm(2)
FATAL: Assertion failed
at assert-comma.asm(23)
+21
View File
@@ -0,0 +1,21 @@
[static_]assert $0
[static_]assert $1
[static_]assert $0 , "hello 2"
[static_]assert $1 , "hello 2"
[static_]assert warn $0
[static_]assert warn $1
[static_]assert warn $0 , "hello 6"
[static_]assert warn $1 , "hello 6"
[static_]assert fail $0
[static_]assert fail $1
[static_]assert fail $0 , "hello 10"
[static_]assert fail $1 , "hello 10"
[static_]assert warn, $0
[static_]assert warn, $1
[static_]assert warn, $0 , "hello 14"
[static_]assert warn, $1 , "hello 14"
[static_]assert fail, $0
[static_]assert fail, $1
[static_]assert fail, $0 , "hello 18"
[static_]assert fail, $1 , "hello 18"
[static_]assert fatal...