1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

toml: fix paths in skipped tests for Windows compatibility (#12323)

This commit is contained in:
Larpon 2021-10-28 14:56:56 +02:00 committed by GitHub
parent 8014235e0e
commit 5ecaa160a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,7 +59,11 @@ fn test_burnt_sushi_tomltest() {
mut valid := 0 mut valid := 0
mut e := 0 mut e := 0
for i, valid_test_file in valid_test_files { for i, valid_test_file in valid_test_files {
relative := valid_test_file.all_after(os.join_path('toml-test', 'tests', 'valid')).trim_left(os.path_separator) mut relative := valid_test_file.all_after(os.join_path('toml-test', 'tests',
'valid')).trim_left(os.path_separator)
$if windows {
relative = relative.replace('/', '\\')
}
if relative !in valid_exceptions { if relative !in valid_exceptions {
println('OK [$i/$valid_test_files.len] "$valid_test_file"...') println('OK [$i/$valid_test_files.len] "$valid_test_file"...')
toml_doc := toml.parse_file(valid_test_file) or { panic(err) } toml_doc := toml.parse_file(valid_test_file) or { panic(err) }
@ -89,8 +93,11 @@ fn test_burnt_sushi_tomltest() {
mut invalid := 0 mut invalid := 0
e = 0 e = 0
for i, invalid_test_file in invalid_test_files { for i, invalid_test_file in invalid_test_files {
relative := invalid_test_file.all_after(os.join_path('toml-test', 'tests', mut relative := invalid_test_file.all_after(os.join_path('toml-test', 'tests',
'invalid')).trim_left(os.path_separator) 'invalid')).trim_left(os.path_separator)
$if windows {
relative = relative.replace('/', '\\')
}
if relative !in invalid_exceptions { if relative !in invalid_exceptions {
println('OK [$i/$invalid_test_files.len] "$invalid_test_file"...') println('OK [$i/$invalid_test_files.len] "$invalid_test_file"...')
if toml_doc := toml.parse_file(invalid_test_file) { if toml_doc := toml.parse_file(invalid_test_file) {