tests: fix the new v2 output tests
parent
67ba56c65c
commit
ae2d001261
|
@ -2,24 +2,30 @@ import os
|
||||||
import term
|
import term
|
||||||
|
|
||||||
fn test_all() {
|
fn test_all() {
|
||||||
files := os.ls('.') or {
|
vexe := os.getenv('VEXE')
|
||||||
|
vroot := os.dir(vexe)
|
||||||
|
dir := os.join_path(vroot,'vlib/v/tests')
|
||||||
|
files := os.ls(dir) or {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
for file in files {
|
println(files)
|
||||||
if !file.ends_with('.vv') {
|
tests := files.filter(it.ends_with('.vv'))
|
||||||
continue
|
if tests.len == 0 {
|
||||||
}
|
println('no compiler tests found')
|
||||||
print(file + ' ')
|
assert false
|
||||||
program := file.replace('.vv', '.v')
|
}
|
||||||
os.cp(file, program) or {
|
for test in tests {
|
||||||
|
path := os.join_path(dir,test)
|
||||||
|
print(test + ' ')
|
||||||
|
program := path.replace('.vv', '.v')
|
||||||
|
os.cp(path, program) or {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
os.rm('exe')
|
os.rm('exe')
|
||||||
x := os.exec('v -o exe -cflags "-w" -cg -backend experimental $program') or {
|
x := os.exec('v -o exe -cflags "-w" -cg -backend experimental $program') or {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
println(x.output.limit(30))
|
// os.rm(program)
|
||||||
os.rm(program)
|
|
||||||
res := os.exec('./exe') or {
|
res := os.exec('./exe') or {
|
||||||
println('nope')
|
println('nope')
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -34,6 +40,7 @@ fn test_all() {
|
||||||
found := res.output.trim_space()
|
found := res.output.trim_space()
|
||||||
if expected != found {
|
if expected != found {
|
||||||
println(term.red('FAIL'))
|
println(term.red('FAIL'))
|
||||||
|
println(x.output.limit(30))
|
||||||
println('============')
|
println('============')
|
||||||
println('expected:')
|
println('expected:')
|
||||||
println(expected)
|
println(expected)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import os
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println('hello world')
|
println('hello world')
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import os
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
areas := ['game', 'web', 'tools', 'science', 'systems', 'embedded']
|
areas := ['game', 'web', 'tools', 'science', 'systems', 'embedded']
|
||||||
for i :=0;i<areas.len; i++{
|
for i :=0;i<areas.len; i++{
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
compiler_test.v
|
CODE_OF_CONDUCT.md
|
||||||
|
CHANGELOG.md
|
||||||
|
README.md
|
||||||
|
CONTRIBUTING.md
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
files := os.ls('.') or { panic(err) }
|
vexe := os.getenv('VEXE')
|
||||||
|
vroot := os.dir(vexe)
|
||||||
|
files := os.ls(vroot) or { panic(err) }
|
||||||
for file in files {
|
for file in files {
|
||||||
if file.ends_with('_test.v') {
|
if file.ends_with('.md') {
|
||||||
println(file)
|
println(file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue