zig/test/cases
Veikka Tuominen 58c1d98c14 add tests for fixed stage1 bugs
Closes #4144
Closes #4255
Closes #4372
Closes #4375
Closes #4380
Closes #4417
Closes #4423
Closes #4476
Closes #4528
Closes #4562
Closes #4572
Closes #4597
Closes #4639
Closes #4672
Closes #4782
Closes #4955
Closes #4984
Closes #4997
Closes #5010
Closes #5114
Closes #5166
Closes #5173
Closes #5276
2022-12-31 20:49:02 -05:00
..
aarch64-linux
aarch64-macos Sema: improve error for mismatched type in implicit return 2022-12-03 00:48:03 +02:00
arm-linux
compile_errors add tests for fixed stage1 bugs 2022-12-31 20:49:02 -05:00
llvm disable failing incremental compilation test case 2022-07-29 02:35:06 -07:00
plan9 link: fix memory leaks 2022-12-28 14:24:27 -05:00
safety Sema: improve safety panic for access of inactive union field 2022-11-29 21:44:08 +02:00
wasm-wasi
x86_64-linux Sema: improve error for mismatched type in implicit return 2022-12-03 00:48:03 +02:00
x86_64-macos Sema: improve error for mismatched type in implicit return 2022-12-03 00:48:03 +02:00
x86_64-windows Sema: improve error for mismatched type in implicit return 2022-12-03 00:48:03 +02:00
adding_numbers_at_runtime_and_comptime.1.zig
adding_numbers_at_runtime_and_comptime.2.zig
adding_numbers_at_runtime_and_comptime.0.zig
ambiguous_reference.zig
bad_inferred_variable_type.zig adjust tests that didn't pass CI 2022-06-30 21:47:26 +03:00
binary_operands.1.zig
binary_operands.2.zig stage2: Split @mulWithOverflow tests 2022-05-07 20:02:02 +02:00
binary_operands.3.zig
binary_operands.4.zig
binary_operands.5.zig
binary_operands.6.zig
binary_operands.7.zig
binary_operands.8.zig
binary_operands.9.zig
binary_operands.10.zig
binary_operands.11.zig
binary_operands.12.zig
binary_operands.13.zig stage2: Split @mulWithOverflow tests 2022-05-07 20:02:02 +02:00
binary_operands.14.zig
binary_operands.15.zig
binary_operands.16.zig
binary_operands.17.zig
binary_operands.18.zig
binary_operands.19.zig
binary_operands.20.zig
binary_operands.21.zig
binary_operands.22.zig
binary_operands.23.zig
binary_operands.24.zig
binary_operands.25.zig
binary_operands.0.zig
break_continue.1.zig
break_continue.2.zig
break_continue.3.zig
break_continue.0.zig
catch_at_comptime.1.zig
catch_at_comptime.2.zig
catch_at_comptime.3.zig
catch_at_comptime.4.zig
catch_at_comptime.0.zig
comparison_of_non-tagged_union_and_enum_literal.zig Sema: improve @call errors 2022-06-30 09:57:38 +02:00
compile_error.zig
compile_log.1.zig
compile_log.0.zig move passing stage1 compile error tests to stage2 2022-06-30 09:57:38 +02:00
double_ampersand.1.zig
double_ampersand.2.zig
double_ampersand.0.zig
enum_values.1.zig
enum_values.0.zig
error_in_nested_declaration.zig stage2: correct node offset of nested declarations 2022-08-09 11:59:10 +03:00
extern_variable_has_no_type.1.zig
extern_variable_has_no_type.0.zig Sema: allow runtime only instructions to be emitted in outside functions 2022-10-20 20:11:00 +03:00
fn_typeinfo_passed_to_comptime_fn.zig std.builtin: rename Type.Fn's args to params 2022-12-17 14:11:33 +01:00
function_calls.1.zig
function_calls.2.zig
function_calls.3.zig
function_calls.0.zig
function_redeclaration.zig AstGen: use 'shadows' instead of 'redeclaration' when names are in different scopes 2022-10-07 11:04:02 +03:00
global_variable_redeclaration.zig
inner_func_accessing_outer_var.zig
int_to_ptr.1.zig
int_to_ptr.0.zig
large_add_function.zig
lower_unnamed_consts_structs.1.zig
lower_unnamed_consts_structs.2.zig
lower_unnamed_consts_structs.0.zig
merge_error_sets.1.zig
merge_error_sets.0.zig
multiplying_numbers_at_runtime_and_comptime.1.zig
multiplying_numbers_at_runtime_and_comptime.2.zig
multiplying_numbers_at_runtime_and_comptime.0.zig
non_leaf_functions.zig
optional_payload.1.zig
optional_payload.2.zig
optional_payload.3.zig
optional_payload.0.zig
orelse_at_comptime.1.zig
orelse_at_comptime.0.zig
passing_u0_to_function.zig
README.md migrate runtime safety tests to the new test harness 2022-05-13 14:03:20 -07:00
recursive_fibonacci.zig stage2 ARM: fix recursive fibonacci 2022-05-22 21:02:32 +02:00
redundant_comptime.1.zig
redundant_comptime.0.zig
returns_in_try.zig stage2: change how defers are stored in Zir 2022-09-12 01:52:44 -04:00
runtime_bitwise_and.zig
runtime_bitwise_or.zig
save_function_return_values_in_callee_preserved_register.zig
setting_an_address_space_on_a_local_variable.zig
taill_call_noreturn.zig update usages of @call 2022-12-13 13:14:20 +02:00
try_in_comptime_in_struct_in_test.zig
type_of.1.zig
type_of.2.zig
type_of.0.zig remove pointless discards in test cases 2022-09-13 02:04:20 -07:00
unused_labels.1.zig
unused_labels.2.zig
unused_labels.3.zig
unused_labels.0.zig
unused_vars.zig
variable_shadowing.1.zig AstGen: use 'shadows' instead of 'redeclaration' when names are in different scopes 2022-10-07 11:04:02 +03:00
variable_shadowing.2.zig
variable_shadowing.3.zig AstGen: use 'shadows' instead of 'redeclaration' when names are in different scopes 2022-10-07 11:04:02 +03:00
variable_shadowing.4.zig AstGen: use 'shadows' instead of 'redeclaration' when names are in different scopes 2022-10-07 11:04:02 +03:00
variable_shadowing.5.zig AstGen: use 'shadows' instead of 'redeclaration' when names are in different scopes 2022-10-07 11:04:02 +03:00
variable_shadowing.6.zig AstGen: use 'shadows' instead of 'redeclaration' when names are in different scopes 2022-10-07 11:04:02 +03:00
variable_shadowing.7.zig AstGen: use 'shadows' instead of 'redeclaration' when names are in different scopes 2022-10-07 11:04:02 +03:00
variable_shadowing.8.zig AstGen: use 'shadows' instead of 'redeclaration' when names are in different scopes 2022-10-07 11:04:02 +03:00
variable_shadowing.9.zig AstGen: use 'shadows' instead of 'redeclaration' when names are in different scopes 2022-10-07 11:04:02 +03:00
variable_shadowing.10.zig AstGen: fix catch payoad not checking for shadowing 2022-07-07 21:38:32 +03:00
variable_shadowing.0.zig disable spuriously failing test on Windows 2022-09-14 16:12:55 -07:00

Test Case Quick Reference

Use comments at the end of the file to indicate metadata about the test case. Here are examples of different kinds of tests:

Compile Error Test

If you want it to be run with zig test and match expected error messages:

// error
// is_test=1
//
// :4:13: error: 'try' outside function scope

Execution

This will do zig run on the code and expect exit code 0.

// run

Incremental Compilation

Make multiple files that have ".", and then an integer, before the ".zig" extension, like this:

hello.0.zig
hello.1.zig
hello.2.zig

Each file can be a different kind of test, such as expecting compile errors, or expecting to be run and exit(0). The test harness will use these to simulate incremental compilation.

At the time of writing there is no way to specify multiple files being changed as part of an update.

Subdirectories

Subdirectories do not have any semantic meaning but they can be used for organization since the test harness will recurse into them. The full directory path will be prepended as a prefix on the test case name.

Limiting which Backends and Targets are Tested

// run
// backend=stage2,llvm
// target=x86_64-linux,x86_64-macos

Possible backends are:

  • stage1: equivalent to -fstage1.
  • stage2: equivalent to passing -fno-stage1 -fno-LLVM.
  • llvm: equivalent to -fLLVM -fno-stage1.