zig/test/cases
2022-09-21 20:21:02 +03:00
..
aarch64-linux test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
aarch64-macos test-cases: fix compiler error locations for hello world with updates 2022-09-07 22:42:57 +02:00
arm-linux test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
compile_errors AstGen: store void to ptr result loc when there is no else branch 2022-09-21 20:21:02 +03:00
llvm disable failing incremental compilation test case 2022-07-29 02:35:06 -07:00
safety std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
wasm-wasi test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
x86_64-linux test-cases: fix compiler error locations for hello world with updates 2022-09-07 22:42:57 +02:00
x86_64-macos test-cases: fix compiler error locations for hello world with updates 2022-09-07 22:42:57 +02:00
x86_64-windows test-cases: add missing incremental x86_64-windows test cases 2022-09-07 22:42:59 +02:00
adding_numbers_at_runtime_and_comptime.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
adding_numbers_at_runtime_and_comptime.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
adding_numbers_at_runtime_and_comptime.2.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
ambiguous_reference.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
bad_inferred_variable_type.zig adjust tests that didn't pass CI 2022-06-30 21:47:26 +03:00
binary_operands.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.2.zig stage2: Split @mulWithOverflow tests 2022-05-07 20:02:02 +02:00
binary_operands.3.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.4.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.5.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.6.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.7.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.8.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.9.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.10.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.11.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.12.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.13.zig stage2: Split @mulWithOverflow tests 2022-05-07 20:02:02 +02:00
binary_operands.14.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.15.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.16.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.17.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.18.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.19.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.20.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.21.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.22.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.23.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.24.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
binary_operands.25.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
break_continue.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
break_continue.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
break_continue.2.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
break_continue.3.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
catch_at_comptime.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
catch_at_comptime.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
catch_at_comptime.2.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
catch_at_comptime.3.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
catch_at_comptime.4.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
comparison_of_non-tagged_union_and_enum_literal.zig Sema: improve @call errors 2022-06-30 09:57:38 +02:00
compile_error_in_inline_fn_call_fixed.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
compile_error_in_inline_fn_call_fixed.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
compile_error.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
compile_log.0.zig move passing stage1 compile error tests to stage2 2022-06-30 09:57:38 +02:00
compile_log.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
double_ampersand.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
double_ampersand.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
double_ampersand.2.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
enum_values.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
enum_values.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
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.0.zig Sema: explain why comptime is needed 2022-07-21 12:21:30 -07:00
extern_variable_has_no_type.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
fn_typeinfo_passed_to_comptime_fn.zig Sema: copy fn param ty in zirTypeInfo 2022-07-27 18:27:17 +03:00
function_calls.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
function_calls.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
function_calls.2.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
function_calls.3.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
function_redeclaration.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
global_variable_redeclaration.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
inner_func_accessing_outer_var.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
int_to_ptr.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
int_to_ptr.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
large_add_function.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
lower_unnamed_consts_structs.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
lower_unnamed_consts_structs.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
lower_unnamed_consts_structs.2.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
merge_error_sets.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
merge_error_sets.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
multiplying_numbers_at_runtime_and_comptime.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
multiplying_numbers_at_runtime_and_comptime.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
multiplying_numbers_at_runtime_and_comptime.2.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
non_leaf_functions.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
optional_payload.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
optional_payload.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
optional_payload.2.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
optional_payload.3.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
orelse_at_comptime.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
orelse_at_comptime.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
passing_u0_to_function.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
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
recursive_inline_function.0.zig macho: read the entire file contents into memory at once 2022-07-22 16:58:20 +02:00
recursive_inline_function.1.zig Sema: add a note about @setEvalBranchQuota() when branch quota is exceeded 2022-07-08 02:13:33 +03:00
redundant_comptime.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
redundant_comptime.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
returns_in_try.zig stage2: change how defers are stored in Zir 2022-09-12 01:52:44 -04:00
runtime_bitwise_and.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
runtime_bitwise_or.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
save_function_return_values_in_callee_preserved_register.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
setting_an_address_space_on_a_local_variable.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
taill_call_noreturn.zig Sema: check that target supports tail calls 2022-08-30 12:22:07 -07:00
try_in_comptime_in_struct_in_test.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
type_of.0.zig remove pointless discards in test cases 2022-09-13 02:04:20 -07:00
type_of.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
type_of.2.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
unused_labels.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
unused_labels.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
unused_labels.2.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
unused_labels.3.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
unused_vars.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
variable_shadowing.0.zig disable spuriously failing test on Windows 2022-09-14 16:12:55 -07:00
variable_shadowing.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
variable_shadowing.2.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
variable_shadowing.3.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
variable_shadowing.4.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
variable_shadowing.5.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
variable_shadowing.6.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
variable_shadowing.7.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
variable_shadowing.8.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
variable_shadowing.9.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
variable_shadowing.10.zig AstGen: fix catch payoad not checking for shadowing 2022-07-07 21:38:32 +03: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.