Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
thedavidmeister committed Dec 29, 2023
1 parent 629dbd5 commit 64afa73
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,7 @@ pub(crate) fn ambiguous_string(scalar: &str) -> bool {
parse_bool(&lower_scalar).is_some()
|| parse_null(&lower_scalar.as_bytes()).is_some()
|| lower_scalar.len() == 0
// Can unwrap because we just checked the length.
|| lower_scalar.bytes().nth(0).unwrap().is_ascii_digit()
|| lower_scalar.starts_with('-')
|| lower_scalar.starts_with('.')
Expand Down
12 changes: 12 additions & 0 deletions tests/test_serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,18 @@ fn test_moar_strings_needing_quote() {
"9.3",
// https://github.com/dtolnay/serde-yaml/pull/398#discussion_r1432944356
"2E234567",
// https://yaml.org/spec/1.2.2/#1022-tag-resolution
"0o7",
"0x3A",
"+12.3",
"0.",
"-0.0",
"12e3",
"-2E+05",
"0",
"-0",
"3",
"-19",
] {
let thing = Struct {
s: s.to_string(),
Expand Down

0 comments on commit 64afa73

Please sign in to comment.