From a0f80053524c521a18963a2027ec368c214e9bdb Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 24 May 2020 21:13:09 +0300 Subject: [PATCH] checker: support tests/run/ folder, checks many warns/errors/output --- vlib/v/checker/checker_test.v | 5 +++- ...xpr_unresolved_variables_err_chain.run.out | 27 +++++++++++++++++++ ...ign_expr_unresolved_variables_err_chain.vv | 5 ++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.run.out create mode 100644 vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.vv diff --git a/vlib/v/checker/checker_test.v b/vlib/v/checker/checker_test.v index 34d5c9c6b4..b590f5d32f 100644 --- a/vlib/v/checker/checker_test.v +++ b/vlib/v/checker/checker_test.v @@ -10,10 +10,13 @@ fn test_all() { classic_tests := get_tests_in_dir(classic_dir) global_dir := '$classic_dir/globals' global_tests := get_tests_in_dir(global_dir) + run_dir := '$classic_dir/run' + run_tests := get_tests_in_dir(run_dir) // -prod so that warns are errors total_errors += check_path(vexe, classic_dir, '-prod', '.out', classic_tests) total_errors += check_path(vexe, global_dir, '--enable-globals', '.out', global_tests) total_errors += check_path(vexe, classic_dir, '--enable-globals run', '.run.out', ['globals_error.vv']) + total_errors += check_path(vexe, run_dir, 'run', '.run.out', run_tests) assert total_errors == 0 } @@ -31,7 +34,7 @@ fn check_path(vexe, dir, voptions, result_extension string, tests []string) int for test in tests { path := os.join_path(dir, test).replace('\\', '/') program := path.replace('.vv', '.v') - print(program + ' ') + print(path + ' ') os.cp(path, program) or { panic(err) } diff --git a/vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.run.out b/vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.run.out new file mode 100644 index 0000000000..adf2eeab2a --- /dev/null +++ b/vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.run.out @@ -0,0 +1,27 @@ +vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.v:3:2: warning: unused variable: `b` + 1 | fn main() { + 2 | a := b + 3 | b := c + | ^ + 4 | c := a + 5 | } +vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.v:4:2: warning: unused variable: `c` + 2 | a := b + 3 | b := c + 4 | c := a + | ^ + 5 | } +vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.v:2:7: error: unresolved variable: `b` + 1 | fn main() { + 2 | a := b + | ^ + 3 | b := c + 4 | c := a +vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.v:3:7: error: unresolved variable: `c` + 1 | fn main() { + 2 | a := b + 3 | b := c + | ^ + 4 | c := a + 5 | } + diff --git a/vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.vv b/vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.vv new file mode 100644 index 0000000000..1f8308c67e --- /dev/null +++ b/vlib/v/checker/tests/run/assign_expr_unresolved_variables_err_chain.vv @@ -0,0 +1,5 @@ +fn main() { + a := b + b := c + c := a +}