1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tests: add .vv support for v vet too, and simplify vet_test.v

This commit is contained in:
Delyan Angelov 2020-08-25 18:46:33 +03:00
parent 86dfd3902f
commit 55fdae77d5
6 changed files with 12 additions and 12 deletions

View File

@ -37,11 +37,15 @@ fn main() {
eprintln('skipping $path') eprintln('skipping $path')
continue continue
} }
if path.ends_with('.v') { if path.ends_with('.v') || path.ends_with('.vv') {
vet_options.vet_file(path) vet_options.vet_file(path)
} else if os.is_dir(path) { } else if os.is_dir(path) {
vet_options.vprintln("vetting folder '$path'...") vet_options.vprintln("vetting folder '$path'...")
files := os.walk_ext(path, '.v') vfiles := os.walk_ext(path, '.v')
vvfiles := os.walk_ext(path, '.vv')
mut files := []string{}
files << vfiles
files << vvfiles
for file in files { for file in files {
if file.ends_with('_test.v') || file.contains('/tests/') { // TODO copy pasta if file.ends_with('_test.v') || file.contains('/tests/') { // TODO copy pasta
continue continue

View File

@ -1,2 +1,2 @@
vlib/v/vet/tests/array_init_one_val.v:2: Use `var == value` instead of `var in [value]` vlib/v/vet/tests/array_init_one_val.vv:2: Use `var == value` instead of `var in [value]`
NB: You can run `v fmt -w file.v` to fix these automatically NB: You can run `v fmt -w file.v` to fix these automatically

View File

@ -1,2 +1,2 @@
vlib/v/vet/tests/indent_with_space.v:2: Looks like you are using spaces for indentation. vlib/v/vet/tests/indent_with_space.vv:2: Looks like you are using spaces for indentation.
NB: You can run `v fmt -w file.v` to fix these automatically NB: You can run `v fmt -w file.v` to fix these automatically

View File

@ -1,2 +1,2 @@
vlib/v/vet/tests/parens_space_a.v:1: Looks like you are adding a space after `(` vlib/v/vet/tests/parens_space_a.vv:1: Looks like you are adding a space after `(`
NB: You can run `v fmt -w file.v` to fix these automatically NB: You can run `v fmt -w file.v` to fix these automatically

View File

@ -1,2 +1,2 @@
vlib/v/vet/tests/parens_space_b.v:1: Looks like you are adding a space before `)` vlib/v/vet/tests/parens_space_b.vv:1: Looks like you are adding a space before `)`
NB: You can run `v fmt -w file.v` to fix these automatically NB: You can run `v fmt -w file.v` to fix these automatically

View File

@ -27,15 +27,12 @@ fn check_path(vexe, dir string, tests []string) int {
basepath: dir basepath: dir
}) })
for path in paths { for path in paths {
program := path.replace('.vv', '.v') program := path
print(path + ' ') print(path + ' ')
os.cp(path, program) or {
panic(err)
}
res := os.exec('$vexe vet $program') or { res := os.exec('$vexe vet $program') or {
panic(err) panic(err)
} }
mut expected := os.read_file(program.replace('.v', '') + '.out') or { mut expected := os.read_file(program.replace('.vv', '') + '.out') or {
panic(err) panic(err)
} }
expected = clean_line_endings(expected) expected = clean_line_endings(expected)
@ -52,7 +49,6 @@ fn check_path(vexe, dir string, tests []string) int {
nb_fail++ nb_fail++
} else { } else {
println(term.green('OK')) println(term.green('OK'))
os.rm(program)
} }
} }
return nb_fail return nb_fail