mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tests: fix the new v2 output tests
This commit is contained in:
parent
67ba56c65c
commit
ae2d001261
@ -2,24 +2,30 @@ import os
|
||||
import term
|
||||
|
||||
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)
|
||||
}
|
||||
for file in files {
|
||||
if !file.ends_with('.vv') {
|
||||
continue
|
||||
}
|
||||
print(file + ' ')
|
||||
program := file.replace('.vv', '.v')
|
||||
os.cp(file, program) or {
|
||||
println(files)
|
||||
tests := files.filter(it.ends_with('.vv'))
|
||||
if tests.len == 0 {
|
||||
println('no compiler tests found')
|
||||
assert false
|
||||
}
|
||||
for test in tests {
|
||||
path := os.join_path(dir,test)
|
||||
print(test + ' ')
|
||||
program := path.replace('.vv', '.v')
|
||||
os.cp(path, program) or {
|
||||
panic(err)
|
||||
}
|
||||
os.rm('exe')
|
||||
x := os.exec('v -o exe -cflags "-w" -cg -backend experimental $program') or {
|
||||
panic(err)
|
||||
}
|
||||
println(x.output.limit(30))
|
||||
os.rm(program)
|
||||
// os.rm(program)
|
||||
res := os.exec('./exe') or {
|
||||
println('nope')
|
||||
panic(err)
|
||||
@ -34,6 +40,7 @@ fn test_all() {
|
||||
found := res.output.trim_space()
|
||||
if expected != found {
|
||||
println(term.red('FAIL'))
|
||||
println(x.output.limit(30))
|
||||
println('============')
|
||||
println('expected:')
|
||||
println(expected)
|
||||
|
@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
fn main() {
|
||||
println('hello world')
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
fn main() {
|
||||
areas := ['game', 'web', 'tools', 'science', 'systems', 'embedded']
|
||||
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
|
||||
|
||||
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 {
|
||||
if file.ends_with('_test.v') {
|
||||
if file.ends_with('.md') {
|
||||
println(file)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user