v/vlib/v/gen/c/testdata
Daniel Däschle 76cdf75299
builtin,cgen: rename `Option` to `_option` (#14317)
2022-05-06 19:25:54 +03:00
..
README.md transformer: minor optimization for `'string literal'.len` (#14207) 2022-04-28 22:35:16 +03:00
addition.c.must_have v: add constant folding AST transformation (#11085) 2021-08-06 23:19:18 +03:00
addition.out v: add constant folding AST transformation (#11085) 2021-08-06 23:19:18 +03:00
addition.vv v: add constant folding AST transformation (#11085) 2021-08-06 23:19:18 +03:00
assert_fncalls.c.must_have v.gen.c: fix assert `f().len == 1` calling f() twice (closes issue 11501) 2021-09-16 19:01:35 +03:00
assert_fncalls.out v.gen.c: fix assert `f().len == 1` calling f() twice (closes issue 11501) 2021-09-16 19:01:35 +03:00
assert_fncalls.vv v.gen.c: fix assert `f().len == 1` calling f() twice (closes issue 11501) 2021-09-16 19:01:35 +03:00
check_combination_of_alias_and_sumtype.c.must_have checker: fixes typechecking for a sum type with an alias type (#13974) 2022-04-13 18:38:26 +03:00
check_combination_of_alias_and_sumtype.vv checker: ensure that the variant SubType exists (#14053) 2022-04-16 19:29:10 +03:00
comp_if_unknown.c.must_have checker: refactor comptime_if_branch (#14259) 2022-05-02 22:24:20 +03:00
comp_if_unknown.vv checker: refactor comptime_if_branch (#14259) 2022-05-02 22:24:20 +03:00
compare_structs.c.must_have ci: fix the recorded output for compare_structs.c.must_have after eea46c4 2022-04-07 18:08:56 +03:00
compare_structs.vv v.gen.c: fix compilation of `if c_struct_1 != c_struct_2 {` 2021-10-02 15:12:18 +03:00
console_windows_program.c.must_have v.gen.c: add coutput tests for the `[console]` codegen to prevent future regressions 2021-10-06 00:14:16 +03:00
console_windows_program.vv v.gen.c: add coutput tests for the `[console]` codegen to prevent future regressions 2021-10-06 00:14:16 +03:00
const_references.c.must_have
const_references.out
const_references.vv
embed.c.must_have ci: fix coutput_test.v 2022-04-15 21:18:55 +03:00
embed.vv tests: support `// vtest vflags: -prod` in `coutput_test.v`. 2021-10-05 15:44:12 +03:00
embed_with_prod.c.must_have ci: fix coutput_test.v 2022-04-15 21:18:55 +03:00
embed_with_prod.out all: support `$embed_file('embed.vv', .zlib)` (#12654) 2021-12-04 19:43:19 +02:00
embed_with_prod.vv tests: support `// vtest vflags: -prod` in `coutput_test.v`. 2021-10-05 15:44:12 +03:00
embed_with_prod_and_several_decoders.c.must_have builtin,cgen: rename `Option` to `_option` (#14317) 2022-05-06 19:25:54 +03:00
embed_with_prod_and_several_decoders.out all: support `$embed_file('embed.vv', .zlib)` (#12654) 2021-12-04 19:43:19 +02:00
embed_with_prod_and_several_decoders.vv all: support `$embed_file('embed.vv', .zlib)` (#12654) 2021-12-04 19:43:19 +02:00
embed_with_prod_zlib.c.must_have ci: fix coutput_test.v 2022-04-15 21:18:55 +03:00
embed_with_prod_zlib.out all: support `$embed_file('embed.vv', .zlib)` (#12654) 2021-12-04 19:43:19 +02:00
embed_with_prod_zlib.vv all: support `$embed_file('embed.vv', .zlib)` (#12654) 2021-12-04 19:43:19 +02:00
enum_switch_case.c.must_have ci: fix sanitize job failures after 02b889d 2022-03-19 21:45:58 +02:00
enum_switch_case.out cgen,js: fix missing break in switch case, generated by match with range branches (#12260) 2021-10-21 22:30:05 +03:00
enum_switch_case.vv cgen,js: fix missing break in switch case, generated by match with range branches (#12260) 2021-10-21 22:30:05 +03:00
export_and_weak.c.must_have builtin: improve musl/Alpine support (define weak backtrace/backtrace_symbols/backtrace_symbols_fd symbols) (#14250) 2022-05-03 09:17:53 +03:00
export_and_weak.out builtin: improve musl/Alpine support (define weak backtrace/backtrace_symbols/backtrace_symbols_fd symbols) (#14250) 2022-05-03 09:17:53 +03:00
export_and_weak.vv builtin: improve musl/Alpine support (define weak backtrace/backtrace_symbols/backtrace_symbols_fd symbols) (#14250) 2022-05-03 09:17:53 +03:00
for_in.c.must_have cgen: fixes for ... in with index (#11995) 2021-09-28 19:35:07 +03:00
for_in.out cgen: fixes for ... in with index (#11995) 2021-09-28 19:35:07 +03:00
for_in.vv cgen: fixes for ... in with index (#11995) 2021-09-28 19:35:07 +03:00
globals_with_weak_tag.c.must_have cgen,vfmt: support `[weak]` tags for functions and globals 2021-11-18 18:32:39 +02:00
globals_with_weak_tag.vv cgen,vfmt: support `[weak]` tags for functions and globals 2021-11-18 18:32:39 +02:00
gui_windows_program.c.must_have v.gen.c: add coutput tests for the `[console]` codegen to prevent future regressions 2021-10-06 00:14:16 +03:00
gui_windows_program.vv v.gen.c: add coutput tests for the `[console]` codegen to prevent future regressions 2021-10-06 00:14:16 +03:00
gui_windows_program_with_console_tag.c.must_have v.gen.c: add coutput tests for the `[console]` codegen to prevent future regressions 2021-10-06 00:14:16 +03:00
gui_windows_program_with_console_tag.vv v.gen.c: add coutput tests for the `[console]` codegen to prevent future regressions 2021-10-06 00:14:16 +03:00
strlit_len_optimization.c.must_have transformer: minor optimization for `'string literal'.len` (#14207) 2022-04-28 22:35:16 +03:00
strlit_len_optimization.out transformer: minor optimization for `'string literal'.len` (#14207) 2022-04-28 22:35:16 +03:00
strlit_len_optimization.vv transformer: minor optimization for `'string literal'.len` (#14207) 2022-04-28 22:35:16 +03:00
volatile.c.must_have all: support `volatile field Type` in struct declarations 2021-11-04 09:45:50 +02:00
volatile.out all: support `volatile field Type` in struct declarations 2021-11-04 09:45:50 +02:00
volatile.vv all: support `volatile field Type` in struct declarations 2021-11-04 09:45:50 +02:00

README.md

Purpose: tests data for the output of V's C code generator

TLDR: v run vlib/v/gen/c/coutput_test.v

coutput_test.v is a test runner, that checks whether the generated C source code matches all expectations, specified in *.c.must_have files, in the folder vlib/v/gen/c/testdata/ .

Each .c.must_have file, has to have a corresponding .vv file.

Each .c.must_have file, consists of multiple lines. Each of these lines, should be present at least once in the output, when the .vv file is compiled with -o - .

Note: this test runner can also be used to verify and keep from regressing partial fixes to V's checker, i.e. ones that make a program type check fine, but that still lead to codegen problems. To do that, put the V code that the checker can typecheck in a .vv file in this folder, then create a corresponding .c.must_have file in this folder too. It should have a single line in it: // THE END. . The V codegen will end every source that it generates with that line, so its presence, effectively guarantees that cgen succeeded/ended, even if the produced C code can not be compiled yet.