Skip to content

Commit

Permalink
testing: fix reliance on os.join_path with , to produce a folder endi…
Browse files Browse the repository at this point in the history
…ng with / or \ (#19913)
  • Loading branch information
spytheman committed Nov 17, 2023
1 parent 76530de commit 157d603
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/tools/modules/testing/common.v
Expand Up @@ -627,6 +627,7 @@ pub fn vlib_should_be_present(parent_dir string) {
pub fn prepare_test_session(zargs string, folder string, oskipped []string, main_label string) TestSession {
vexe := pref.vexe_path()
parent_dir := os.dir(vexe)
nparent_dir := parent_dir.replace('\\', '/')
vlib_should_be_present(parent_dir)
vargs := zargs.replace(vexe, '')
eheader(main_label)
Expand All @@ -653,19 +654,18 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main
continue
}
}
c := os.read_file(f) or { panic(err) }
c := os.read_file(fnormalised) or { panic(err) }
start := c#[0..testing.header_bytes_to_search_for_module_main]
if start.contains('module ') && !start.contains('module main') {
skipped_f := f.replace(os.join_path_single(parent_dir, ''), '')
skipped << skipped_f
skipped << fnormalised.replace(nparent_dir + '/', '')
}
for skip_prefix in oskipped {
skip_folder := skip_prefix + '/'
if fnormalised.starts_with(skip_folder) {
continue next_file
}
}
mains << f
mains << fnormalised
}
session.files << mains
session.skip_files << skipped
Expand Down

0 comments on commit 157d603

Please sign in to comment.