toml: improve SKIP reporting, fix formatting
							parent
							
								
									ee858568ff
								
							
						
					
					
						commit
						e03d52d322
					
				|  | @ -35,7 +35,7 @@ const ( | |||
| 		'valid/table-array-nest.toml', | ||||
| 		'valid/table-array-nest-no-keys.toml', | ||||
| 	] | ||||
| 
 | ||||
| 	tests_folder           = os.join_path('test-suite', 'tests') | ||||
| 	jq                     = os.find_abs_path_of_executable('jq') or { '' } | ||||
| 	compare_work_dir_root  = os.join_path(os.temp_dir(), 'v', 'toml', 'alexcrichton') | ||||
| 	// From: https://stackoverflow.com/a/38266731/1904615
 | ||||
|  | @ -73,21 +73,22 @@ fn test_alexcrichton_toml_rs() ? { | |||
| 		mut valid := 0 | ||||
| 		mut e := 0 | ||||
| 		for i, valid_test_file in valid_test_files { | ||||
| 			mut relative := valid_test_file.all_after(os.join_path('test-suite', 'tests')).trim_left(os.path_separator) | ||||
| 			mut relative := valid_test_file.all_after(tests_folder).trim_left(os.path_separator) | ||||
| 			$if windows { | ||||
| 				relative = relative.replace('/', '\\') | ||||
| 			} | ||||
| 
 | ||||
| 			if relative !in valid_exceptions { | ||||
| 				if !hide_oks { | ||||
| 					println('OK   [${i + 1}/$valid_test_files.len] "$valid_test_file"...') | ||||
| 				} | ||||
| 				toml_doc := toml.parse_file(valid_test_file) ? | ||||
| 				valid++ | ||||
| 			} else { | ||||
| 			if relative in valid_exceptions { | ||||
| 				e++ | ||||
| 				println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" EXCEPTION [$e/$valid_exceptions.len]...') | ||||
| 				idx := valid_exceptions.index(relative) + 1 | ||||
| 				println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" VALID EXCEPTION [$idx/$valid_exceptions.len]...') | ||||
| 				continue | ||||
| 			} | ||||
| 			if !hide_oks { | ||||
| 				println('OK   [${i + 1}/$valid_test_files.len] "$valid_test_file"...') | ||||
| 			} | ||||
| 			toml_doc := toml.parse_file(valid_test_file) ? | ||||
| 			valid++ | ||||
| 		} | ||||
| 		println('$valid/$valid_test_files.len TOML files were parsed correctly') | ||||
| 		if valid_exceptions.len > 0 { | ||||
|  | @ -109,7 +110,7 @@ fn test_alexcrichton_toml_rs() ? { | |||
| 			valid = 0 | ||||
| 			e = 0 | ||||
| 			for i, valid_test_file in valid_test_files { | ||||
| 				mut relative := valid_test_file.all_after(os.join_path('test-suite', 'tests')).trim_left(os.path_separator) | ||||
| 				mut relative := valid_test_file.all_after(tests_folder).trim_left(os.path_separator) | ||||
| 				$if windows { | ||||
| 					relative = relative.replace('/', '\\') | ||||
| 				} | ||||
|  | @ -118,46 +119,53 @@ fn test_alexcrichton_toml_rs() ? { | |||
| 					continue | ||||
| 				} | ||||
| 				// Skip the file if we know it can't be parsed or we know that the value retrieval needs work.
 | ||||
| 				if relative !in valid_exceptions && relative !in valid_value_exceptions { | ||||
| 					if !hide_oks { | ||||
| 						println('OK   [${i + 1}/$valid_test_files.len] "$valid_test_file"...') | ||||
| 					} | ||||
| 					toml_doc := toml.parse_file(valid_test_file) ? | ||||
| 
 | ||||
| 					v_toml_json_path := os.join_path(compare_work_dir_root, | ||||
| 						os.file_name(valid_test_file).all_before_last('.') + '.v.json') | ||||
| 					alexcrichton_toml_json_path := os.join_path(compare_work_dir_root, | ||||
| 						os.file_name(valid_test_file).all_before_last('.') + '.json') | ||||
| 
 | ||||
| 					mut array_type := 1 | ||||
| 					if relative in use_type_2_arrays { | ||||
| 						array_type = 2 | ||||
| 					} | ||||
| 
 | ||||
| 					os.write_file(v_toml_json_path, to_alexcrichton(toml_doc.ast.table, | ||||
| 						array_type)) ? | ||||
| 
 | ||||
| 					alexcrichton_json := os.read_file(valid_test_file.all_before_last('.') + '.json') ? | ||||
| 					 | ||||
| 					os.write_file(alexcrichton_toml_json_path, alexcrichton_json) ? | ||||
| 
 | ||||
| 					v_normalized_json := run([jq, '-S', '-f "$jq_normalize_path"', v_toml_json_path]) or { | ||||
| 						contents := os.read_file(v_toml_json_path) ? | ||||
| 						panic(err.msg + '\n$contents') | ||||
| 					} | ||||
| 					alexcrichton_normalized_json := run([jq, '-S', '-f "$jq_normalize_path"', | ||||
| 						alexcrichton_toml_json_path]) or { | ||||
| 						contents := os.read_file(v_toml_json_path) ? | ||||
| 						panic(err.msg + '\n$contents') | ||||
| 					} | ||||
| 
 | ||||
| 					assert alexcrichton_normalized_json == v_normalized_json | ||||
| 
 | ||||
| 					valid++ | ||||
| 				} else { | ||||
| 				if relative in valid_exceptions { | ||||
| 					e++ | ||||
| 					println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" EXCEPTION [$e/$valid_value_exceptions.len]...') | ||||
| 					idx := valid_exceptions.index(relative) + 1 | ||||
| 					println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" VALID EXCEPTION [$idx/$valid_exceptions.len]...') | ||||
| 					continue | ||||
| 				} | ||||
| 				if relative in valid_value_exceptions { | ||||
| 					e++ | ||||
| 					idx := valid_value_exceptions.index(relative) + 1 | ||||
| 					println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" VALID VALUE EXCEPTION [$idx/$valid_value_exceptions.len]...') | ||||
| 					continue | ||||
| 				} | ||||
| 
 | ||||
| 				if !hide_oks { | ||||
| 					println('OK   [${i + 1}/$valid_test_files.len] "$valid_test_file"...') | ||||
| 				} | ||||
| 				toml_doc := toml.parse_file(valid_test_file) ? | ||||
| 
 | ||||
| 				v_toml_json_path := os.join_path(compare_work_dir_root, | ||||
| 					os.file_name(valid_test_file).all_before_last('.') + '.v.json') | ||||
| 				alexcrichton_toml_json_path := os.join_path(compare_work_dir_root, | ||||
| 					os.file_name(valid_test_file).all_before_last('.') + '.json') | ||||
| 
 | ||||
| 				mut array_type := 1 | ||||
| 				if relative in use_type_2_arrays { | ||||
| 					array_type = 2 | ||||
| 				} | ||||
| 
 | ||||
| 				os.write_file(v_toml_json_path, to_alexcrichton(toml_doc.ast.table, array_type)) ? | ||||
| 
 | ||||
| 				alexcrichton_json := os.read_file(valid_test_file.all_before_last('.') + '.json') ? | ||||
| 
 | ||||
| 				os.write_file(alexcrichton_toml_json_path, alexcrichton_json) ? | ||||
| 
 | ||||
| 				v_normalized_json := run([jq, '-S', '-f "$jq_normalize_path"', v_toml_json_path]) or { | ||||
| 					contents := os.read_file(v_toml_json_path) ? | ||||
| 					panic(err.msg + '\n$contents') | ||||
| 				} | ||||
| 				alexcrichton_normalized_json := run([jq, '-S', '-f "$jq_normalize_path"', | ||||
| 					alexcrichton_toml_json_path]) or { | ||||
| 					contents := os.read_file(v_toml_json_path) ? | ||||
| 					panic(err.msg + '\n$contents') | ||||
| 				} | ||||
| 
 | ||||
| 				assert alexcrichton_normalized_json == v_normalized_json | ||||
| 
 | ||||
| 				valid++ | ||||
| 			} | ||||
| 			println('$valid/$valid_test_files.len TOML files were parsed correctly and value checked') | ||||
| 			if valid_value_exceptions.len > 0 { | ||||
|  | @ -171,29 +179,31 @@ fn test_alexcrichton_toml_rs() ? { | |||
| 		mut invalid := 0 | ||||
| 		e = 0 | ||||
| 		for i, invalid_test_file in invalid_test_files { | ||||
| 			mut relative := invalid_test_file.all_after(os.join_path('test-suite', 'tests')).trim_left(os.path_separator) | ||||
| 			mut relative := invalid_test_file.all_after(tests_folder).trim_left(os.path_separator) | ||||
| 			$if windows { | ||||
| 				relative = relative.replace('/', '\\') | ||||
| 			} | ||||
| 			if relative !in invalid_exceptions { | ||||
| 				if !hide_oks { | ||||
| 					println('OK   [${i + 1}/$invalid_test_files.len] "$invalid_test_file"...') | ||||
| 				} | ||||
| 				if toml_doc := toml.parse_file(invalid_test_file) { | ||||
| 					content_that_should_have_failed := os.read_file(invalid_test_file) ? | ||||
| 					println('     This TOML should have failed:\n${'-'.repeat(40)}\n$content_that_should_have_failed\n${'-'.repeat(40)}') | ||||
| 					assert false | ||||
| 				} else { | ||||
| 					if !hide_oks { | ||||
| 						println('     $err.msg') | ||||
| 					} | ||||
| 					assert true | ||||
| 				} | ||||
| 				invalid++ | ||||
| 			} else { | ||||
| 			if relative in invalid_exceptions { | ||||
| 				e++ | ||||
| 				println('SKIP [${i + 1}/$invalid_test_files.len] "$invalid_test_file" EXCEPTION [$e/$invalid_exceptions.len]...') | ||||
| 				idx := invalid_exceptions.index(relative) + 1 | ||||
| 				println('SKIP [${i + 1}/$invalid_test_files.len] "$invalid_test_file" INVALID EXCEPTION [$idx/$invalid_exceptions.len]...') | ||||
| 				continue | ||||
| 			} | ||||
| 
 | ||||
| 			if !hide_oks { | ||||
| 				println('OK   [${i + 1}/$invalid_test_files.len] "$invalid_test_file"...') | ||||
| 			} | ||||
| 			if toml_doc := toml.parse_file(invalid_test_file) { | ||||
| 				content_that_should_have_failed := os.read_file(invalid_test_file) ? | ||||
| 				println('     This TOML should have failed:\n${'-'.repeat(40)}\n$content_that_should_have_failed\n${'-'.repeat(40)}') | ||||
| 				assert false | ||||
| 			} else { | ||||
| 				if !hide_oks { | ||||
| 					println('     $err.msg') | ||||
| 				} | ||||
| 				assert true | ||||
| 			} | ||||
| 			invalid++ | ||||
| 		} | ||||
| 		println('$invalid/$invalid_test_files.len TOML files were parsed correctly') | ||||
| 		if invalid_exceptions.len > 0 { | ||||
|  |  | |||
|  | @ -57,131 +57,140 @@ fn test_burnt_sushi_tomltest() ? { | |||
| 	this_file := @FILE | ||||
| 	test_root := os.join_path(os.dir(this_file), 'testdata', 'burntsushi', 'toml-test', | ||||
| 		'tests') | ||||
| 	if os.is_dir(test_root) { | ||||
| 		valid_test_files := os.walk_ext(os.join_path(test_root, 'valid'), '.toml') | ||||
| 		println('Testing $valid_test_files.len valid TOML files...') | ||||
| 		mut valid := 0 | ||||
| 		mut e := 0 | ||||
| 		for i, valid_test_file in valid_test_files { | ||||
| 			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 !hide_oks { | ||||
| 					println('OK   [${i + 1}/$valid_test_files.len] "$valid_test_file"...') | ||||
| 				} | ||||
| 				toml_doc := toml.parse_file(valid_test_file) ? | ||||
| 				valid++ | ||||
| 			} else { | ||||
| 				e++ | ||||
| 				println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" EXCEPTION [$e/$valid_exceptions.len]...') | ||||
| 			} | ||||
| 		} | ||||
| 		println('$valid/$valid_test_files.len TOML files were parsed correctly') | ||||
| 		if valid_exceptions.len > 0 { | ||||
| 			println('TODO Skipped parsing of $valid_exceptions.len valid TOML files...') | ||||
| 		} | ||||
| 
 | ||||
| 		// If the command-line tool `jq` is installed, value tests can be run as well.
 | ||||
| 		if jq != '' { | ||||
| 			println('Testing value output of $valid_test_files.len valid TOML files using "$jq"...') | ||||
| 
 | ||||
| 			if os.exists(compare_work_dir_root) { | ||||
| 				os.rmdir_all(compare_work_dir_root) ? | ||||
| 			} | ||||
| 			os.mkdir_all(compare_work_dir_root) ? | ||||
| 
 | ||||
| 			jq_normalize_path := os.join_path(compare_work_dir_root, 'normalize.jq') | ||||
| 			os.write_file(jq_normalize_path, jq_normalize) ? | ||||
| 
 | ||||
| 			valid = 0 | ||||
| 			e = 0 | ||||
| 			for i, valid_test_file in valid_test_files { | ||||
| 				mut relative := valid_test_file.all_after(os.join_path('toml-test', 'tests', | ||||
| 					'valid')).trim_left(os.path_separator) | ||||
| 				$if windows { | ||||
| 					relative = relative.replace('/', '\\') | ||||
| 				} | ||||
| 				// Skip the file if we know it can't be parsed or we know that the value retrieval needs work.
 | ||||
| 				if relative !in valid_exceptions && relative !in valid_value_exceptions { | ||||
| 					if !hide_oks { | ||||
| 						println('OK   [${i + 1}/$valid_test_files.len] "$valid_test_file"...') | ||||
| 					} | ||||
| 					toml_doc := toml.parse_file(valid_test_file) ? | ||||
| 
 | ||||
| 					v_toml_json_path := os.join_path(compare_work_dir_root, | ||||
| 						os.file_name(valid_test_file).all_before_last('.') + '.v.json') | ||||
| 					bs_toml_json_path := os.join_path(compare_work_dir_root, | ||||
| 						os.file_name(valid_test_file).all_before_last('.') + '.json') | ||||
| 
 | ||||
| 					os.write_file(v_toml_json_path, to_burntsushi(toml_doc.ast.table)) ? | ||||
| 
 | ||||
| 					bs_json := os.read_file(valid_test_file.all_before_last('.') + '.json') ? | ||||
| 
 | ||||
| 					os.write_file(bs_toml_json_path, bs_json) ? | ||||
| 
 | ||||
| 					v_normalized_json := run([jq, '-S', '-f "$jq_normalize_path"', v_toml_json_path]) or { | ||||
| 						contents := os.read_file(v_toml_json_path) ? | ||||
| 						panic(err.msg + '\n$contents') | ||||
| 					} | ||||
| 					bs_normalized_json := run([jq, '-S', '-f "$jq_normalize_path"', bs_toml_json_path]) or { | ||||
| 						contents := os.read_file(v_toml_json_path) ? | ||||
| 						panic(err.msg + '\n$contents') | ||||
| 					} | ||||
| 
 | ||||
| 					assert bs_normalized_json == v_normalized_json | ||||
| 
 | ||||
| 					valid++ | ||||
| 				} else { | ||||
| 					e++ | ||||
| 					println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" EXCEPTION [$e/$valid_value_exceptions.len]...') | ||||
| 				} | ||||
| 			} | ||||
| 			println('$valid/$valid_test_files.len TOML files were parsed correctly and value checked') | ||||
| 			if valid_value_exceptions.len > 0 { | ||||
| 				println('TODO Skipped value checks of $valid_value_exceptions.len valid TOML files...') | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		invalid_test_files := os.walk_ext(os.join_path(test_root, 'invalid'), '.toml') | ||||
| 		println('Testing $invalid_test_files.len invalid TOML files...') | ||||
| 		mut invalid := 0 | ||||
| 		e = 0 | ||||
| 		for i, invalid_test_file in invalid_test_files { | ||||
| 			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 { | ||||
| 				if !hide_oks { | ||||
| 					println('OK   [${i + 1}/$invalid_test_files.len] "$invalid_test_file"...') | ||||
| 				} | ||||
| 				if toml_doc := toml.parse_file(invalid_test_file) { | ||||
| 					content_that_should_have_failed := os.read_file(invalid_test_file) ? | ||||
| 					println('     This TOML should have failed:\n${'-'.repeat(40)}\n$content_that_should_have_failed\n${'-'.repeat(40)}') | ||||
| 					assert false | ||||
| 				} else { | ||||
| 					if !hide_oks { | ||||
| 						println('     $err.msg') | ||||
| 					} | ||||
| 					assert true | ||||
| 				} | ||||
| 				invalid++ | ||||
| 			} else { | ||||
| 				e++ | ||||
| 				println('SKIP [${i + 1}/$invalid_test_files.len] "$invalid_test_file" EXCEPTION [$e/$invalid_exceptions.len]...') | ||||
| 			} | ||||
| 		} | ||||
| 		println('$invalid/$invalid_test_files.len TOML files were parsed correctly') | ||||
| 		if invalid_exceptions.len > 0 { | ||||
| 			println('TODO Skipped parsing of $invalid_exceptions.len invalid TOML files...') | ||||
| 		} | ||||
| 	} else { | ||||
| 	if !os.is_dir(test_root) { | ||||
| 		println('No test data directory found in "$test_root"') | ||||
| 		assert true | ||||
| 		return | ||||
| 	} | ||||
| 	valid_folder := os.join_path('toml-test', 'tests', 'valid') | ||||
| 	invalid_folder := os.join_path('toml-test', 'tests', 'invalid') | ||||
| 	valid_test_files := os.walk_ext(os.join_path(test_root, 'valid'), '.toml') | ||||
| 	println('Testing $valid_test_files.len valid TOML files...') | ||||
| 	mut valid := 0 | ||||
| 	mut e := 0 | ||||
| 	for i, valid_test_file in valid_test_files { | ||||
| 		mut relative := valid_test_file.all_after(valid_folder).trim_left(os.path_separator) | ||||
| 		$if windows { | ||||
| 			relative = relative.replace('/', '\\') | ||||
| 		} | ||||
| 		if relative in valid_exceptions { | ||||
| 			e++ | ||||
| 			idx := valid_exceptions.index(relative) + 1 | ||||
| 			println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" VALID EXCEPTION [$idx/$valid_exceptions.len]...') | ||||
| 			continue | ||||
| 		} | ||||
| 		if !hide_oks { | ||||
| 			println('OK   [${i + 1}/$valid_test_files.len] "$valid_test_file"...') | ||||
| 		} | ||||
| 		toml_doc := toml.parse_file(valid_test_file) ? | ||||
| 		valid++ | ||||
| 	} | ||||
| 	println('$valid/$valid_test_files.len TOML files were parsed correctly') | ||||
| 	if valid_exceptions.len > 0 { | ||||
| 		println('TODO Skipped parsing of $valid_exceptions.len valid TOML files...') | ||||
| 	} | ||||
| 
 | ||||
| 	// If the command-line tool `jq` is installed, value tests can be run as well.
 | ||||
| 	if jq != '' { | ||||
| 		println('Testing value output of $valid_test_files.len valid TOML files using "$jq"...') | ||||
| 
 | ||||
| 		if os.exists(compare_work_dir_root) { | ||||
| 			os.rmdir_all(compare_work_dir_root) ? | ||||
| 		} | ||||
| 		os.mkdir_all(compare_work_dir_root) ? | ||||
| 
 | ||||
| 		jq_normalize_path := os.join_path(compare_work_dir_root, 'normalize.jq') | ||||
| 		os.write_file(jq_normalize_path, jq_normalize) ? | ||||
| 
 | ||||
| 		valid = 0 | ||||
| 		e = 0 | ||||
| 		for i, valid_test_file in valid_test_files { | ||||
| 			mut relative := valid_test_file.all_after(valid_folder).trim_left(os.path_separator) | ||||
| 			$if windows { | ||||
| 				relative = relative.replace('/', '\\') | ||||
| 			} | ||||
| 			// Skip the file if we know it can't be parsed or we know that the value retrieval needs work.
 | ||||
| 			if relative in valid_exceptions { | ||||
| 				e++ | ||||
| 				idx := valid_exceptions.index(relative) + 1 | ||||
| 				println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" VALID EXCEPTION [$idx/$valid_exceptions.len]...') | ||||
| 				continue | ||||
| 			} | ||||
| 			if relative in valid_value_exceptions { | ||||
| 				e++ | ||||
| 				idx := valid_value_exceptions.index(relative) + 1 | ||||
| 				println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" VALID VALUE EXCEPTION [$idx/$valid_value_exceptions.len]...') | ||||
| 				continue | ||||
| 			} | ||||
| 
 | ||||
| 			if !hide_oks { | ||||
| 				println('OK   [${i + 1}/$valid_test_files.len] "$valid_test_file"...') | ||||
| 			} | ||||
| 			toml_doc := toml.parse_file(valid_test_file) ? | ||||
| 
 | ||||
| 			v_toml_json_path := os.join_path(compare_work_dir_root, | ||||
| 				os.file_name(valid_test_file).all_before_last('.') + '.v.json') | ||||
| 			bs_toml_json_path := os.join_path(compare_work_dir_root, | ||||
| 				os.file_name(valid_test_file).all_before_last('.') + '.json') | ||||
| 
 | ||||
| 			os.write_file(v_toml_json_path, to_burntsushi(toml_doc.ast.table)) ? | ||||
| 
 | ||||
| 			bs_json := os.read_file(valid_test_file.all_before_last('.') + '.json') ? | ||||
| 
 | ||||
| 			os.write_file(bs_toml_json_path, bs_json) ? | ||||
| 
 | ||||
| 			v_normalized_json := run([jq, '-S', '-f "$jq_normalize_path"', v_toml_json_path]) or { | ||||
| 				contents := os.read_file(v_toml_json_path) ? | ||||
| 				panic(err.msg + '\n$contents') | ||||
| 			} | ||||
| 			bs_normalized_json := run([jq, '-S', '-f "$jq_normalize_path"', bs_toml_json_path]) or { | ||||
| 				contents := os.read_file(v_toml_json_path) ? | ||||
| 				panic(err.msg + '\n$contents') | ||||
| 			} | ||||
| 
 | ||||
| 			assert bs_normalized_json == v_normalized_json | ||||
| 
 | ||||
| 			valid++ | ||||
| 		} | ||||
| 	} | ||||
| 	println('$valid/$valid_test_files.len TOML files were parsed correctly and value checked') | ||||
| 	if valid_value_exceptions.len > 0 { | ||||
| 		println('TODO Skipped value checks of $valid_value_exceptions.len valid TOML files...') | ||||
| 	} | ||||
| 
 | ||||
| 	invalid_test_files := os.walk_ext(os.join_path(test_root, 'invalid'), '.toml') | ||||
| 	println('Testing $invalid_test_files.len invalid TOML files...') | ||||
| 	mut invalid := 0 | ||||
| 	e = 0 | ||||
| 	for i, invalid_test_file in invalid_test_files { | ||||
| 		mut relative := invalid_test_file.all_after(invalid_folder).trim_left(os.path_separator) | ||||
| 		$if windows { | ||||
| 			relative = relative.replace('/', '\\') | ||||
| 		} | ||||
| 		if relative in invalid_exceptions { | ||||
| 			e++ | ||||
| 			idx := invalid_exceptions.index(relative) + 1 | ||||
| 			println('SKIP [${i + 1}/$invalid_test_files.len] "$invalid_test_file" INVALID EXCEPTION [$idx/$invalid_exceptions.len]...') | ||||
| 			continue | ||||
| 		} | ||||
| 		if !hide_oks { | ||||
| 			println('OK   [${i + 1}/$invalid_test_files.len] "$invalid_test_file"...') | ||||
| 		} | ||||
| 		if toml_doc := toml.parse_file(invalid_test_file) { | ||||
| 			content_that_should_have_failed := os.read_file(invalid_test_file) ? | ||||
| 			println('     This TOML should have failed:\n${'-'.repeat(40)}\n$content_that_should_have_failed\n${'-'.repeat(40)}') | ||||
| 			assert false | ||||
| 		} else { | ||||
| 			if !hide_oks { | ||||
| 				println('     $err.msg') | ||||
| 			} | ||||
| 			assert true | ||||
| 		} | ||||
| 		invalid++ | ||||
| 	} | ||||
| 	println('$invalid/$invalid_test_files.len TOML files were parsed correctly') | ||||
| 	if invalid_exceptions.len > 0 { | ||||
| 		println('TODO Skipped parsing of $invalid_exceptions.len invalid TOML files...') | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -91,7 +91,7 @@ fn test_iarna_toml_spec_tests() ? { | |||
| 
 | ||||
| 			if relative in valid_exceptions { | ||||
| 				e++ | ||||
| 				idx := valid_exceptions.index(relative) | ||||
| 				idx := valid_exceptions.index(relative) + 1 | ||||
| 				println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" VALID EXCEPTION [$idx/$valid_exceptions.len]...') | ||||
| 				continue | ||||
| 			} | ||||
|  | @ -130,17 +130,15 @@ fn test_iarna_toml_spec_tests() ? { | |||
| 				// Skip the file if we know it can't be parsed or we know that the value retrieval needs work.
 | ||||
| 				if relative in valid_exceptions { | ||||
| 					e++ | ||||
| 					idx := valid_exceptions.index(relative) | ||||
| 					println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" VALID EXCEPTION [${ | ||||
| 						idx + 1}/$valid_exceptions.len]...') | ||||
| 					idx := valid_exceptions.index(relative) + 1 | ||||
| 					println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" VALID EXCEPTION [$idx/$valid_exceptions.len]...') | ||||
| 					continue | ||||
| 				} | ||||
| 
 | ||||
| 				if relative in valid_value_exceptions { | ||||
| 					e++ | ||||
| 					idx := valid_value_exceptions.index(relative) | ||||
| 					println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" VALID VALUE EXCEPTION [${ | ||||
| 						idx + 1}/$valid_value_exceptions.len]...') | ||||
| 					idx := valid_value_exceptions.index(relative) + 1 | ||||
| 					println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" VALID VALUE EXCEPTION [$idx/$valid_value_exceptions.len]...') | ||||
| 					continue | ||||
| 				} | ||||
| 
 | ||||
|  | @ -162,7 +160,7 @@ fn test_iarna_toml_spec_tests() ? { | |||
| 					} | ||||
| 					if !do_yaml_conversion || relative in yaml_value_exceptions { | ||||
| 						e++ | ||||
| 						idx := yaml_value_exceptions.index(relative) | ||||
| 						idx := yaml_value_exceptions.index(relative) + 1 | ||||
| 						println('SKIP [${i + 1}/$valid_test_files.len] "$valid_test_file" YAML VALUE EXCEPTION [$idx/$valid_value_exceptions.len]...') | ||||
| 						continue | ||||
| 					} | ||||
|  | @ -239,7 +237,7 @@ fn test_iarna_toml_spec_tests() ? { | |||
| 			} | ||||
| 			if relative in invalid_exceptions { | ||||
| 				e++ | ||||
| 				idx := invalid_exceptions.index(relative) | ||||
| 				idx := invalid_exceptions.index(relative) + 1 | ||||
| 				println('SKIP [${i + 1}/$invalid_test_files.len] "$invalid_test_file" INVALID EXCEPTION [$idx/$invalid_exceptions.len]...') | ||||
| 				continue | ||||
| 			} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue