| ... | ... | @@ -374,36 +374,36 @@ pub fn addCases(ctx: *TestContext) !void { |
| 374 | 374 | // , ""); |
| 375 | 375 | //} |
| 376 | 376 | |
| 377 | | //{ |
| 378 | | // var case = ctx.exeFromCompiledC("errors", .{}); |
| 379 | | // case.addCompareOutput( |
| 380 | | // \\export fn main() c_int { |
| 381 | | // \\ var e1 = error.Foo; |
| 382 | | // \\ var e2 = error.Bar; |
| 383 | | // \\ assert(e1 != e2); |
| 384 | | // \\ assert(e1 == error.Foo); |
| 385 | | // \\ assert(e2 == error.Bar); |
| 386 | | // \\ return 0; |
| 387 | | // \\} |
| 388 | | // \\fn assert(b: bool) void { |
| 389 | | // \\ if (!b) unreachable; |
| 390 | | // \\} |
| 391 | | // , ""); |
| 392 | | // case.addCompareOutput( |
| 393 | | // \\export fn main() c_int { |
| 394 | | // \\ var e: anyerror!c_int = 0; |
| 395 | | // \\ const i = e catch 69; |
| 396 | | // \\ return i; |
| 397 | | // \\} |
| 398 | | // , ""); |
| 399 | | // case.addCompareOutput( |
| 400 | | // \\export fn main() c_int { |
| 401 | | // \\ var e: anyerror!c_int = error.Foo; |
| 402 | | // \\ const i = e catch 69; |
| 403 | | // \\ return 69 - i; |
| 404 | | // \\} |
| 405 | | // , ""); |
| 406 | | //} |
| 377 | { |
| 378 | var case = ctx.exeFromCompiledC("errors", .{}); |
| 379 | case.addCompareOutput( |
| 380 | \\export fn main() c_int { |
| 381 | \\ var e1 = error.Foo; |
| 382 | \\ var e2 = error.Bar; |
| 383 | \\ assert(e1 != e2); |
| 384 | \\ assert(e1 == error.Foo); |
| 385 | \\ assert(e2 == error.Bar); |
| 386 | \\ return 0; |
| 387 | \\} |
| 388 | \\fn assert(b: bool) void { |
| 389 | \\ if (!b) unreachable; |
| 390 | \\} |
| 391 | , ""); |
| 392 | case.addCompareOutput( |
| 393 | \\export fn main() c_int { |
| 394 | \\ var e: anyerror!c_int = 0; |
| 395 | \\ const i = e catch 69; |
| 396 | \\ return i; |
| 397 | \\} |
| 398 | , ""); |
| 399 | case.addCompareOutput( |
| 400 | \\export fn main() c_int { |
| 401 | \\ var e: anyerror!c_int = error.Foo; |
| 402 | \\ const i = e catch 69; |
| 403 | \\ return 69 - i; |
| 404 | \\} |
| 405 | , ""); |
| 406 | } |
| 407 | 407 | ctx.c("empty start function", linux_x64, |
| 408 | 408 | \\export fn _start() noreturn { |
| 409 | 409 | \\ unreachable; |
| ... | ... | @@ -417,64 +417,64 @@ pub fn addCases(ctx: *TestContext) !void { |
| 417 | 417 | \\} |
| 418 | 418 | \\ |
| 419 | 419 | ); |
| 420 | | //ctx.h("simple header", linux_x64, |
| 421 | | // \\export fn start() void{} |
| 422 | | //, |
| 423 | | // \\ZIG_EXTERN_C void start(void); |
| 424 | | // \\ |
| 425 | | //); |
| 426 | | //ctx.h("header with single param function", linux_x64, |
| 427 | | // \\export fn start(a: u8) void{} |
| 428 | | //, |
| 429 | | // \\ZIG_EXTERN_C void start(uint8_t a0); |
| 430 | | // \\ |
| 431 | | //); |
| 432 | | //ctx.h("header with multiple param function", linux_x64, |
| 433 | | // \\export fn start(a: u8, b: u8, c: u8) void{} |
| 434 | | //, |
| 435 | | // \\ZIG_EXTERN_C void start(uint8_t a0, uint8_t a1, uint8_t a2); |
| 436 | | // \\ |
| 437 | | //); |
| 438 | | //ctx.h("header with u32 param function", linux_x64, |
| 439 | | // \\export fn start(a: u32) void{} |
| 440 | | //, |
| 441 | | // \\ZIG_EXTERN_C void start(uint32_t a0); |
| 442 | | // \\ |
| 443 | | //); |
| 444 | | //ctx.h("header with usize param function", linux_x64, |
| 445 | | // \\export fn start(a: usize) void{} |
| 446 | | //, |
| 447 | | // \\ZIG_EXTERN_C void start(uintptr_t a0); |
| 448 | | // \\ |
| 449 | | //); |
| 450 | | //ctx.h("header with bool param function", linux_x64, |
| 451 | | // \\export fn start(a: bool) void{} |
| 452 | | //, |
| 453 | | // \\ZIG_EXTERN_C void start(bool a0); |
| 454 | | // \\ |
| 455 | | //); |
| 456 | | //ctx.h("header with noreturn function", linux_x64, |
| 457 | | // \\export fn start() noreturn { |
| 458 | | // \\ unreachable; |
| 459 | | // \\} |
| 460 | | //, |
| 461 | | // \\ZIG_EXTERN_C zig_noreturn void start(void); |
| 462 | | // \\ |
| 463 | | //); |
| 464 | | //ctx.h("header with multiple functions", linux_x64, |
| 465 | | // \\export fn a() void{} |
| 466 | | // \\export fn b() void{} |
| 467 | | // \\export fn c() void{} |
| 468 | | //, |
| 469 | | // \\ZIG_EXTERN_C void a(void); |
| 470 | | // \\ZIG_EXTERN_C void b(void); |
| 471 | | // \\ZIG_EXTERN_C void c(void); |
| 472 | | // \\ |
| 473 | | //); |
| 474 | | //ctx.h("header with multiple includes", linux_x64, |
| 475 | | // \\export fn start(a: u32, b: usize) void{} |
| 476 | | //, |
| 477 | | // \\ZIG_EXTERN_C void start(uint32_t a0, uintptr_t a1); |
| 478 | | // \\ |
| 479 | | //); |
| 420 | ctx.h("simple header", linux_x64, |
| 421 | \\export fn start() void{} |
| 422 | , |
| 423 | \\ZIG_EXTERN_C void start(void); |
| 424 | \\ |
| 425 | ); |
| 426 | ctx.h("header with single param function", linux_x64, |
| 427 | \\export fn start(a: u8) void{} |
| 428 | , |
| 429 | \\ZIG_EXTERN_C void start(uint8_t a0); |
| 430 | \\ |
| 431 | ); |
| 432 | ctx.h("header with multiple param function", linux_x64, |
| 433 | \\export fn start(a: u8, b: u8, c: u8) void{} |
| 434 | , |
| 435 | \\ZIG_EXTERN_C void start(uint8_t a0, uint8_t a1, uint8_t a2); |
| 436 | \\ |
| 437 | ); |
| 438 | ctx.h("header with u32 param function", linux_x64, |
| 439 | \\export fn start(a: u32) void{} |
| 440 | , |
| 441 | \\ZIG_EXTERN_C void start(uint32_t a0); |
| 442 | \\ |
| 443 | ); |
| 444 | ctx.h("header with usize param function", linux_x64, |
| 445 | \\export fn start(a: usize) void{} |
| 446 | , |
| 447 | \\ZIG_EXTERN_C void start(uintptr_t a0); |
| 448 | \\ |
| 449 | ); |
| 450 | ctx.h("header with bool param function", linux_x64, |
| 451 | \\export fn start(a: bool) void{} |
| 452 | , |
| 453 | \\ZIG_EXTERN_C void start(bool a0); |
| 454 | \\ |
| 455 | ); |
| 456 | ctx.h("header with noreturn function", linux_x64, |
| 457 | \\export fn start() noreturn { |
| 458 | \\ unreachable; |
| 459 | \\} |
| 460 | , |
| 461 | \\ZIG_EXTERN_C zig_noreturn void start(void); |
| 462 | \\ |
| 463 | ); |
| 464 | ctx.h("header with multiple functions", linux_x64, |
| 465 | \\export fn a() void{} |
| 466 | \\export fn b() void{} |
| 467 | \\export fn c() void{} |
| 468 | , |
| 469 | \\ZIG_EXTERN_C void a(void); |
| 470 | \\ZIG_EXTERN_C void b(void); |
| 471 | \\ZIG_EXTERN_C void c(void); |
| 472 | \\ |
| 473 | ); |
| 474 | ctx.h("header with multiple includes", linux_x64, |
| 475 | \\export fn start(a: u32, b: usize) void{} |
| 476 | , |
| 477 | \\ZIG_EXTERN_C void start(uint32_t a0, uintptr_t a1); |
| 478 | \\ |
| 479 | ); |
| 480 | 480 | } |