| 1 | import os |
| 2 | |
| 3 | const vexe = @VEXE |
| 4 | const vfmt_test_tdir = os.join_path(os.vtmp_dir(), 'vfmt_test_25005') |
| 5 | |
| 6 | fn testsuite_begin() { |
| 7 | os.rmdir_all(vfmt_test_tdir) or {} |
| 8 | os.mkdir_all(vfmt_test_tdir)! |
| 9 | } |
| 10 | |
| 11 | fn testsuite_end() { |
| 12 | os.rmdir_all(vfmt_test_tdir) or {} |
| 13 | } |
| 14 | |
| 15 | fn test_fmt_keeps_invalid_assert_source_unchanged() { |
| 16 | source_path := os.join_path(vfmt_test_tdir, 'invalid_assert_message.v') |
| 17 | original := "fn main() {\n\tassert false 'bye'\n}\n" |
| 18 | os.write_file(source_path, original)! |
| 19 | |
| 20 | res := os.execute('${os.quoted_path(vexe)} fmt -w ${os.quoted_path(source_path)}') |
| 21 | |
| 22 | assert res.exit_code != 0, res.output |
| 23 | assert res.output.contains('unexpected string `bye`, expecting `,`'), res.output |
| 24 | assert os.read_file(source_path)! == original |
| 25 | } |
| 26 | |