Fix typo in at_path (#173)

* ENH: tests: replacing tabs with '\t'.

* NEW: tests: adding tests for `path`

Added the test that detects an error in the code.
Code fixing in the following commit.

* FIX: at_path: typo in `parse_path`

Fixing bug in the code. Also fixing `path - parsing` tests.

* NEW: readme: update list of contributors
This commit is contained in:
Alexey Ismagilov 2022-09-19 02:52:48 +03:00 committed by GitHub
parent c6deadf61d
commit fb8ce80350
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

View File

@ -277,6 +277,7 @@ UTF-8 decoding is performed using a state machine based on Bjoern Hoehrmann's '[
- **[@traversaro](https://github.com/traversaro)** - Added vcpkg support and reported a bunch of bugs
- **[@whiterabbit963](https://github.com/whiterabbit963)** - Fixed a bug with value_or conversions
- **[@ximion](https://github.com/ximion)** - Added support for installation with meson
- **[@a-is](https://github.com/a-is)** - Fixed a bug
<br>

View File

@ -97,7 +97,7 @@ TOML_IMPL_NAMESPACE_START
}
else if TOML_UNLIKELY(c == '.' || c == '[')
break;
else if (c == '\t' || c == '.')
else if (c == '\t' || c == ' ')
pos++;
else
return false;

View File

@ -16,7 +16,8 @@ TEST_CASE("path - parsing")
CHECK(toml::path(" [1][2]").str() == " [1][2]");
CHECK(toml::path("a. .b").str() == "a. .b");
CHECK(toml::path("test[23]").str() == "test[23]");
CHECK(toml::path("[ 120 ]").str() == "[120]");
CHECK(toml::path("[ 120 ]").str() == "[120]");
CHECK(toml::path("[ 120\t\t]").str() == "[120]");
CHECK(toml::path("test.value").str() == "test.value");
CHECK(toml::path("test[0].value").str() == "test[0].value");
CHECK(toml::path("test[1][2]\t .value").str() == "test[1][2].value");
@ -31,7 +32,8 @@ TEST_CASE("path - parsing")
CHECK(toml::path(L" [1][2]").str() == " [1][2]");
CHECK(toml::path(L"a. .b").str() == "a. .b");
CHECK(toml::path(L"test[23]").str() == "test[23]");
CHECK(toml::path(L"[ 120 ]").str() == "[120]");
CHECK(toml::path(L"[ 120 ]").str() == "[120]");
CHECK(toml::path(L"[ 120\t\t]").str() == "[120]");
CHECK(toml::path(L"test.value").str() == "test.value");
CHECK(toml::path(L"test[0].value").str() == "test[0].value");
CHECK(toml::path(L"test[1][2]\t .value").str() == "test[1][2].value");

View File

@ -10490,7 +10490,7 @@ TOML_IMPL_NAMESPACE_START
}
else if TOML_UNLIKELY(c == '.' || c == '[')
break;
else if (c == '\t' || c == '.')
else if (c == '\t' || c == ' ')
pos++;
else
return false;