mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 05:20:34 +00:00
Use abort() instead of assert()
Let's see if the Windows/MacOS CI like this more...
This commit is contained in:
parent
5b34697b21
commit
6a72eb1541
@ -4,18 +4,18 @@ const nl = std.cstr.line_sep;
|
||||
|
||||
pub fn addCases(cases: *tests.RunTranslatedCContext) void {
|
||||
cases.add("ternary operator",
|
||||
\\#include <assert.h>
|
||||
\\#include <stdlib.h>
|
||||
\\static int cnt = 0;
|
||||
\\int foo() { cnt++; return 42; }
|
||||
\\int main(int argc, char **argv) {
|
||||
\\ short q = 3;
|
||||
\\ signed char z0 = q?:1;
|
||||
\\ assert(z0 == 3);
|
||||
\\ if (z0 != 3) abort();
|
||||
\\ int z1 = 3?:1;
|
||||
\\ assert(z1 == 3);
|
||||
\\ if (z1 != 3) abort();
|
||||
\\ int z2 = foo()?:-1;
|
||||
\\ assert(z2 == 42);
|
||||
\\ assert(cnt == 1);
|
||||
\\ if (z2 != 42) abort();
|
||||
\\ if (cnt != 1) abort();
|
||||
\\ return 0;
|
||||
\\}
|
||||
, "");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user