From 64afa739f39ded93bfbbe3fb8e49720eb4c6d12d Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Sat, 30 Dec 2023 01:46:13 +0400 Subject: [PATCH] more test cases --- src/de.rs | 1 + tests/test_serde.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/de.rs b/src/de.rs index 806950e2..640e8795 100644 --- a/src/de.rs +++ b/src/de.rs @@ -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('.') diff --git a/tests/test_serde.rs b/tests/test_serde.rs index c440b698..bd1fd7fe 100644 --- a/tests/test_serde.rs +++ b/tests/test_serde.rs @@ -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(),