tests: support `VTEST_ONLY=parser ./v vlib/v/compiler_errors_test.v`
parent
c0a0949932
commit
ce31c4c03e
|
@ -69,6 +69,7 @@ pub fn (mut ts TestSession) test() {
|
||||||
//
|
//
|
||||||
ts.init()
|
ts.init()
|
||||||
mut remaining_files := []string{}
|
mut remaining_files := []string{}
|
||||||
|
vtest_only := os.getenv('VTEST_ONLY')
|
||||||
for dot_relative_file in ts.files {
|
for dot_relative_file in ts.files {
|
||||||
relative_file := dot_relative_file.replace('./', '')
|
relative_file := dot_relative_file.replace('./', '')
|
||||||
file := os.real_path(relative_file)
|
file := os.real_path(relative_file)
|
||||||
|
@ -92,6 +93,11 @@ pub fn (mut ts TestSession) test() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if vtest_only.len > 0 {
|
||||||
|
if !file.contains(vtest_only) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
remaining_files << dot_relative_file
|
remaining_files << dot_relative_file
|
||||||
}
|
}
|
||||||
ts.files = remaining_files
|
ts.files = remaining_files
|
||||||
|
|
|
@ -33,9 +33,19 @@ fn get_tests_in_dir(dir string) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_path(vexe, dir, voptions, result_extension string, tests []string) int {
|
fn check_path(vexe, dir, voptions, result_extension string, tests []string) int {
|
||||||
|
vtest_only := os.getenv('VTEST_ONLY')
|
||||||
mut nb_fail := 0
|
mut nb_fail := 0
|
||||||
|
mut paths := []string{}
|
||||||
for test in tests {
|
for test in tests {
|
||||||
path := os.join_path(dir, test).replace('\\', '/')
|
path := os.join_path(dir, test).replace('\\', '/')
|
||||||
|
if vtest_only.len > 0 {
|
||||||
|
if !path.contains(vtest_only) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
paths << path
|
||||||
|
}
|
||||||
|
for path in paths {
|
||||||
program := path.replace('.vv', '.v')
|
program := path.replace('.vv', '.v')
|
||||||
print(path + ' ')
|
print(path + ' ')
|
||||||
os.cp(path, program) or {
|
os.cp(path, program) or {
|
||||||
|
@ -68,5 +78,10 @@ fn check_path(vexe, dir, voptions, result_extension string, tests []string) int
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clean_line_endings(s string) string {
|
fn clean_line_endings(s string) string {
|
||||||
return s.trim_space().replace(' \n', '\n').replace(' \r\n', '\n').replace('\r\n', '\n').trim('\n')
|
mut res := s.trim_space()
|
||||||
|
res = res.replace(' \n', '\n')
|
||||||
|
res = res.replace(' \r\n', '\n')
|
||||||
|
res = res.replace('\r\n', '\n')
|
||||||
|
res = res.trim('\n')
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue