| 1 | import os |
| 2 | |
| 3 | const vexe = @VEXE |
| 4 | const tests_dir = os.dir(@FILE) |
| 5 | const v3_dir = os.dir(tests_dir) |
| 6 | const v3_src = os.join_path(v3_dir, 'v3.v') |
| 7 | |
| 8 | // test_unknown_function_stops_in_type_checker validates this v3 regression case. |
| 9 | fn test_unknown_function_stops_in_type_checker() { |
| 10 | v3_bin := os.join_path(os.temp_dir(), 'v3_unknown_fn_error_test') |
| 11 | build := os.execute('${vexe} -o ${v3_bin} ${v3_src}') |
| 12 | assert build.exit_code == 0 |
| 13 | |
| 14 | bad_src := os.join_path(os.temp_dir(), 'v3_unknown_fn_error_input.v') |
| 15 | os.write_file(bad_src, 'fn main() {\n\tx := missing_fn()\n\tprintln(x)\n}\n')! |
| 16 | bad_bin := os.join_path(os.temp_dir(), 'v3_unknown_fn_error_input') |
| 17 | result := os.execute('${v3_bin} ${bad_src} -b c -o ${bad_bin}') |
| 18 | assert result.exit_code != 0 |
| 19 | assert result.output.contains('unknown function `missing_fn`') |
| 20 | assert !result.output.contains('C compilation failed') |
| 21 | } |
| 22 | |