zig/test/cases
Andrew Kelley 7d2e142679
Merge pull request #12044 from Vexu/stage2-compile-errors
Sema: add detailed error notes to `coerceInMemoryAllowed`
2022-07-11 20:45:27 -04:00
..
aarch64-linux test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
aarch64-macos Sema: add notes about function return type 2022-07-11 17:55:19 +03:00
arm-linux test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
compile_errors Merge pull request #12044 from Vexu/stage2-compile-errors 2022-07-11 20:45:27 -04:00
llvm move passing stage1 compile error tests to stage2 2022-06-30 09:57:38 +02:00
riscv64-linux test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
safety runtime safety tests only on the native target 2022-05-13 17:59:06 -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 Sema: add notes about function return type 2022-07-11 17:55:19 +03:00
x86_64-macos Sema: add notes about function return type 2022-07-11 17:55:19 +03: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
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
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.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
binary_operands.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
break_continue.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
catch_at_comptime.0.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.1.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.0.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.1.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
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
double_ampersand.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
enum_values.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02: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
extern_variable_has_no_type.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_calls.0.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.1.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
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.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
lower_unnamed_consts_structs.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
merge_error_sets.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
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
non_leaf_functions.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
optional_payload.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
orelse_at_comptime.0.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.1.zig Sema: add a note about @setEvalBranchQuota() when branch quota is exceeded 2022-07-08 02:13:33 +03:00
recursive_inline_function.0.zig test: return error on unknown config value 2022-06-28 13:28:05 +02:00
redundant_comptime.1.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
redundant_comptime.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02:00
returns_in_try.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02: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
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.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
type_of.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_labels.0.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.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
variable_shadowing.0.zig test: move compile errors and incremental tests into common dir 2022-05-04 23:51:16 +02: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.