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

pull/12298/head
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
1 changed files with 9 additions and 2 deletions

View File

@ -59,7 +59,11 @@ fn test_burnt_sushi_tomltest() {
mut valid := 0
mut e := 0
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 {
println('OK [$i/$valid_test_files.len] "$valid_test_file"...')
toml_doc := toml.parse_file(valid_test_file) or { panic(err) }
@ -89,8 +93,11 @@ fn test_burnt_sushi_tomltest() {
mut invalid := 0
e = 0
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)
$if windows {
relative = relative.replace('/', '\\')
}
if relative !in invalid_exceptions {
println('OK [$i/$invalid_test_files.len] "$invalid_test_file"...')
if toml_doc := toml.parse_file(invalid_test_file) {