mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: support tests/run/ folder, checks many warns/errors/output
This commit is contained in:
parent
23e8c8ecda
commit
a0f8005352
@ -10,10 +10,13 @@ fn test_all() {
|
|||||||
classic_tests := get_tests_in_dir(classic_dir)
|
classic_tests := get_tests_in_dir(classic_dir)
|
||||||
global_dir := '$classic_dir/globals'
|
global_dir := '$classic_dir/globals'
|
||||||
global_tests := get_tests_in_dir(global_dir)
|
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
|
// -prod so that warns are errors
|
||||||
total_errors += check_path(vexe, classic_dir, '-prod', '.out', classic_tests)
|
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, 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, 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
|
assert total_errors == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +34,7 @@ fn check_path(vexe, dir, voptions, result_extension string, tests []string) int
|
|||||||
for test in tests {
|
for test in tests {
|
||||||
path := os.join_path(dir, test).replace('\\', '/')
|
path := os.join_path(dir, test).replace('\\', '/')
|
||||||
program := path.replace('.vv', '.v')
|
program := path.replace('.vv', '.v')
|
||||||
print(program + ' ')
|
print(path + ' ')
|
||||||
os.cp(path, program) or {
|
os.cp(path, program) or {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -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 | }
|
||||||
|
|
@ -0,0 +1,5 @@
|
|||||||
|
fn main() {
|
||||||
|
a := b
|
||||||
|
b := c
|
||||||
|
c := a
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user