| 1 | import os |
| 2 | import term |
| 3 | |
| 4 | const vexe = @VEXE |
| 5 | const vroot = os.dir(vexe) |
| 6 | |
| 7 | fn test_print_v_files_in_stdout_mode() { |
| 8 | check_parsing_files_in_folder('vlib/v/parser/testdata/stdout', '-print-v-files') |
| 9 | } |
| 10 | |
| 11 | fn test_print_v_files_in_silent_mode() { |
| 12 | check_parsing_files_in_folder('vlib/v/parser/testdata/silent', '-silent -print-v-files') |
| 13 | } |
| 14 | |
| 15 | fn test_print_watched_files_in_silent_mode__used_by_vwatch() { |
| 16 | check_parsing_files_in_folder('vlib/v/parser/testdata/silent', '-silent -print-watched-files') |
| 17 | } |
| 18 | |
| 19 | fn check_parsing_files_in_folder(folder string, options string) { |
| 20 | println(term.colorize(term.magenta, |
| 21 | '> checking .vv files in folder: `${folder}`, with `${options}` ...')) |
| 22 | files := os.walk_ext(os.join_path(vroot, folder), '.vv') |
| 23 | for f in files { |
| 24 | cmd := '${os.quoted_path(vexe)} ${options} ${os.quoted_path(f)}' |
| 25 | eprintln('> cmd: ${cmd}') |
| 26 | res := os.execute(cmd) |
| 27 | assert res.exit_code == 0, 'failed cmd: ${cmd}, output:\n${res.output}' |
| 28 | assert res.output.split_into_lines().len > 10, 'there should be several files printed by cmd: ${cmd}' |
| 29 | } |
| 30 | } |
| 31 | |