fix emitting of scientific number with one exponent digit

fixes #390
This commit is contained in:
Joao Paulo Magalhaes
2024-03-28 03:20:47 +00:00
parent 66c936e898
commit 739ad42f01
3 changed files with 10 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
### Fixes
- Fix [#390](https://github.com/biojppm/rapidyaml/pull/390) - `csubstr::first_real_span()` failed on number with one digit in the exponent.
- Fix [#361](https://github.com/biojppm/rapidyaml/pull/361) - parse error on map scalars containing `:` and starting on the next line:
```yaml
---

View File

@@ -511,6 +511,14 @@ TEST(json, nested_end)
R"({"a": "b","d": "e","c": {"a": "b","d": "e","c": {"a": "b","d": "e","c": {"a": "b","d": "e","c": {"a": "b","d": "e","c": {}}}}}})");
}
TEST(json, issue390)
{
const Tree tree = parse_in_arena(R"(quntity: 9.5e7
quntity2: 95000000)");
EXPECT_TRUE(csubstr("9.5e7").is_number());
EXPECT_EQ(emitrs_json<std::string>(tree), R"({"quntity": 9.5e7,"quntity2": 95000000})");
}
#undef _test