| 1 | import os |
| 2 | import term |
| 3 | |
| 4 | const vexe = @VEXE |
| 5 | const vroot = os.dir(vexe) |
| 6 | |
| 7 | fn test_check_syntax_in_silent_mode() { |
| 8 | check_parsing_files_in_folder('vlib/v/parser/testdata/silent', '-silent -check-syntax') |
| 9 | } |
| 10 | |
| 11 | fn check_parsing_files_in_folder(folder string, options string) { |
| 12 | println(term.colorize(term.magenta, |
| 13 | '> checking .vv files in folder: `${folder}`, with `${options}` ...')) |
| 14 | files := os.walk_ext(os.join_path(vroot, folder), '.vv') |
| 15 | for f in files { |
| 16 | cmd := '${os.quoted_path(vexe)} ${options} ${os.quoted_path(f)}' |
| 17 | eprintln('> cmd: ${cmd}') |
| 18 | res := os.execute(cmd) |
| 19 | assert res.exit_code == 1, 'Command should fail silently, but did not: `${cmd}`, output:\n${res.output}' |
| 20 | assert res.output.trim_space() == '', 'there should be no output printed by comd: `${cmd}`' |
| 21 | } |
| 22 | } |
| 23 | |