Skip to content

Commit 79f5254

Browse files
committed
Use display method on PathBuf in tests
1 parent 53b8bf7 commit 79f5254

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

tests/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn test_error_parse() {
2626
assert!(res.is_err());
2727
assert_eq!(
2828
res.unwrap_err().to_string(),
29-
format!("failed to parse datetime for key `error` at line 2 column 9 in {}", path.to_str().unwrap())
29+
format!("failed to parse datetime for key `error` at line 2 column 9 in {}", path.display())
3030
);
3131
}
3232

@@ -41,7 +41,7 @@ fn test_error_type() {
4141
assert!(res.is_err());
4242
assert_eq!(
4343
res.unwrap_err().to_string(),
44-
format!("invalid type: string \"fals\", expected a boolean for key `boolean_s_parse` in {}", path.to_str().unwrap())
44+
format!("invalid type: string \"fals\", expected a boolean for key `boolean_s_parse` in {}", path.display())
4545
);
4646
}
4747

tests/file_hjson.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ fn test_error_parse() {
7575
assert!(res.is_err());
7676
assert_eq!(
7777
res.unwrap_err().to_string(),
78-
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())
78+
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())
7979
);
8080
}

tests/file_ini.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ fn test_error_parse() {
6363
assert!(res.is_err());
6464
assert_eq!(
6565
res.unwrap_err().to_string(),
66-
format!(r#"2:0 Expecting "[Some('='), Some(':')]" but found EOF. in {}"#, path.to_str().unwrap())
66+
format!(r#"2:0 Expecting "[Some('='), Some(':')]" but found EOF. in {}"#, path.display())
6767
);
6868
}

tests/file_json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ fn test_error_parse() {
7575
assert!(res.is_err());
7676
assert_eq!(
7777
res.unwrap_err().to_string(),
78-
format!("expected `:` at line 4 column 1 in {}", path_with_extension.to_str().unwrap())
78+
format!("expected `:` at line 4 column 1 in {}", path_with_extension.display())
7979
);
8080
}

tests/file_toml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,6 @@ fn test_error_parse() {
8585
assert!(res.is_err());
8686
assert_eq!(
8787
res.unwrap_err().to_string(),
88-
format!("failed to parse datetime for key `error` at line 2 column 9 in {}", path_with_extension.to_str().unwrap())
88+
format!("failed to parse datetime for key `error` at line 2 column 9 in {}", path_with_extension.display())
8989
);
9090
}

tests/file_yaml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@ fn test_error_parse() {
7676
assert_eq!(
7777
res.unwrap_err().to_string(),
7878
format!("while parsing a block mapping, did not find expected key at \
79-
line 2 column 1 in {}", path_with_extension.to_str().unwrap())
79+
line 2 column 1 in {}", path_with_extension.display())
8080
);
8181
}

0 commit comments

Comments
 (0)