From 79f5254c3926431063d0b2d6ffbd8154984a22ef Mon Sep 17 00:00:00 2001 From: rdkt13 Date: Mon, 7 Sep 2020 23:37:59 +0200 Subject: Use `display` method on PathBuf in tests --- tests/errors.rs | 4 ++-- tests/file_hjson.rs | 2 +- tests/file_ini.rs | 2 +- tests/file_json.rs | 2 +- tests/file_toml.rs | 2 +- tests/file_yaml.rs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/errors.rs b/tests/errors.rs index 159473e..3a626c7 100644 --- a/tests/errors.rs +++ b/tests/errors.rs @@ -26,7 +26,7 @@ fn test_error_parse() { assert!(res.is_err()); assert_eq!( res.unwrap_err().to_string(), - format!("failed to parse datetime for key `error` at line 2 column 9 in {}", path.to_str().unwrap()) + format!("failed to parse datetime for key `error` at line 2 column 9 in {}", path.display()) ); } @@ -41,7 +41,7 @@ fn test_error_type() { assert!(res.is_err()); assert_eq!( res.unwrap_err().to_string(), - format!("invalid type: string \"fals\", expected a boolean for key `boolean_s_parse` in {}", path.to_str().unwrap()) + format!("invalid type: string \"fals\", expected a boolean for key `boolean_s_parse` in {}", path.display()) ); } diff --git a/tests/file_hjson.rs b/tests/file_hjson.rs index 1e99b87..70d7ca0 100644 --- a/tests/file_hjson.rs +++ b/tests/file_hjson.rs @@ -75,6 +75,6 @@ fn test_error_parse() { assert!(res.is_err()); assert_eq!( res.unwrap_err().to_string(), - format!("Found a punctuator where a key name was expected (check your syntax or use quotes if the key name includes {{}}[],: or whitespace) at line 4 column 1 in {}", path.to_str().unwrap()) + format!("Found a punctuator where a key name was expected (check your syntax or use quotes if the key name includes {{}}[],: or whitespace) at line 4 column 1 in {}", path.display()) ); } diff --git a/tests/file_ini.rs b/tests/file_ini.rs index 057e496..0b7b6a0 100644 --- a/tests/file_ini.rs +++ b/tests/file_ini.rs @@ -63,6 +63,6 @@ fn test_error_parse() { assert!(res.is_err()); assert_eq!( res.unwrap_err().to_string(), - format!(r#"2:0 Expecting "[Some('='), Some(':')]" but found EOF. in {}"#, path.to_str().unwrap()) + format!(r#"2:0 Expecting "[Some('='), Some(':')]" but found EOF. in {}"#, path.display()) ); } diff --git a/tests/file_json.rs b/tests/file_json.rs index 1262585..09c42bb 100644 --- a/tests/file_json.rs +++ b/tests/file_json.rs @@ -75,6 +75,6 @@ fn test_error_parse() { assert!(res.is_err()); assert_eq!( res.unwrap_err().to_string(), - format!("expected `:` at line 4 column 1 in {}", path_with_extension.to_str().unwrap()) + format!("expected `:` at line 4 column 1 in {}", path_with_extension.display()) ); } diff --git a/tests/file_toml.rs b/tests/file_toml.rs index a2a1caf..4d2015e 100644 --- a/tests/file_toml.rs +++ b/tests/file_toml.rs @@ -85,6 +85,6 @@ fn test_error_parse() { assert!(res.is_err()); assert_eq!( res.unwrap_err().to_string(), - format!("failed to parse datetime for key `error` at line 2 column 9 in {}", path_with_extension.to_str().unwrap()) + format!("failed to parse datetime for key `error` at line 2 column 9 in {}", path_with_extension.display()) ); } diff --git a/tests/file_yaml.rs b/tests/file_yaml.rs index efc2908..8f7814e 100644 --- a/tests/file_yaml.rs +++ b/tests/file_yaml.rs @@ -76,6 +76,6 @@ fn test_error_parse() { assert_eq!( res.unwrap_err().to_string(), format!("while parsing a block mapping, did not find expected key at \ - line 2 column 1 in {}", path_with_extension.to_str().unwrap()) + line 2 column 1 in {}", path_with_extension.display()) ); } -- cgit v1.2.3