diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index 0cd10213a0..f9eae90eff 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -69,7 +69,7 @@ pub fn (mut ts TestSession) test() { // ts.init() mut remaining_files := []string{} - vtest_only := os.getenv('VTEST_ONLY') + vtest_only := os.getenv('VTEST_ONLY').split(',') for dot_relative_file in ts.files { relative_file := dot_relative_file.replace('./', '') file := os.real_path(relative_file) @@ -94,7 +94,14 @@ pub fn (mut ts TestSession) test() { } } if vtest_only.len > 0 { - if !file.contains(vtest_only) { + mut found := 0 + for substring in vtest_only { + if file.contains(substring) { + found++ + break + } + } + if found == 0 { continue } } diff --git a/vlib/v/compiler_errors_test.v b/vlib/v/compiler_errors_test.v index 28fddf2e1f..7a73b85b61 100644 --- a/vlib/v/compiler_errors_test.v +++ b/vlib/v/compiler_errors_test.v @@ -33,13 +33,20 @@ fn get_tests_in_dir(dir string) []string { } fn check_path(vexe, dir, voptions, result_extension string, tests []string) int { - vtest_only := os.getenv('VTEST_ONLY') + vtest_only := os.getenv('VTEST_ONLY').split(',') mut nb_fail := 0 mut paths := []string{} for test in tests { path := os.join_path(dir, test).replace('\\', '/') if vtest_only.len > 0 { - if !path.contains(vtest_only) { + mut found := 0 + for substring in vtest_only { + if path.contains(substring) { + found++ + break + } + } + if found == 0 { continue } } diff --git a/vlib/v/tests/inout/compiler_test.v b/vlib/v/tests/inout/compiler_test.v index a84d7b3d90..946de75bec 100644 --- a/vlib/v/tests/inout/compiler_test.v +++ b/vlib/v/tests/inout/compiler_test.v @@ -16,8 +16,25 @@ fn test_all() { println('no compiler tests found') assert false } + vtest_only := os.getenv('VTEST_ONLY').split(',') + mut paths := []string{} for test in tests { path := os.join_path(dir, test).replace('\\', '/') + if vtest_only.len > 0 { + mut found := 0 + for substring in vtest_only { + if path.contains(substring) { + found++ + break + } + } + if found == 0 { + continue + } + } + paths << path + } + for path in paths { print(path + ' ') program := path.replace('.vv', '.v') os.cp(path, program) or {