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:
parent
86dfd3902f
commit
55fdae77d5
@ -37,11 +37,15 @@ fn main() {
|
||||
eprintln('skipping $path')
|
||||
continue
|
||||
}
|
||||
if path.ends_with('.v') {
|
||||
if path.ends_with('.v') || path.ends_with('.vv') {
|
||||
vet_options.vet_file(path)
|
||||
} else if os.is_dir(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 {
|
||||
if file.ends_with('_test.v') || file.contains('/tests/') { // TODO copy pasta
|
||||
continue
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -27,15 +27,12 @@ fn check_path(vexe, dir string, tests []string) int {
|
||||
basepath: dir
|
||||
})
|
||||
for path in paths {
|
||||
program := path.replace('.vv', '.v')
|
||||
program := path
|
||||
print(path + ' ')
|
||||
os.cp(path, program) or {
|
||||
panic(err)
|
||||
}
|
||||
res := os.exec('$vexe vet $program') or {
|
||||
panic(err)
|
||||
}
|
||||
mut expected := os.read_file(program.replace('.v', '') + '.out') or {
|
||||
mut expected := os.read_file(program.replace('.vv', '') + '.out') or {
|
||||
panic(err)
|
||||
}
|
||||
expected = clean_line_endings(expected)
|
||||
@ -52,7 +49,6 @@ fn check_path(vexe, dir string, tests []string) int {
|
||||
nb_fail++
|
||||
} else {
|
||||
println(term.green('OK'))
|
||||
os.rm(program)
|
||||
}
|
||||
}
|
||||
return nb_fail
|
||||
|
Loading…
Reference in New Issue
Block a user