diff options
| author | nicole mazzuca <mazzucan@outlook.com> | 2020-08-02 10:08:07 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-02 10:08:07 -0700 |
| commit | 1c2af994151fb3e177df54f89223b056ecddbcec (patch) | |
| tree | 263cdf1db448c2a0610191922c7c6036c4a4b366 /toolsrc/src/vcpkg-test/json.cpp | |
| parent | c0f23c6c31ea7af5a751ea48a043dc64a872f4a0 (diff) | |
| download | vcpkg-1c2af994151fb3e177df54f89223b056ecddbcec.tar.gz vcpkg-1c2af994151fb3e177df54f89223b056ecddbcec.zip | |
[vcpkg format-manifest] Add convert-control flag (#12471)
* [vcpkg format-manifest] initial convert-control attempt
TODO: manifest comments! we should keep $directives
* Finalize x-format-manifest
First, fix Json::parse -- "\c", for any c, was incorrectly parsed.
It would emit the escaped character, and then parse the character, so
that `\b` would give you { '\b', 'b' }.
Second, canonicalize source paragraphs as we're parsing them. This found
an error in qt5 -- The `declarative` feature was listed twice, and we
now catch it, so I removed the second paragraph.
Add PlatformExpression::complexity to allow ordering platform
expressions in a somewhat reasonable way.
Notes:
- We allow `all_modules` as a feature name for back-compat with
paraview
- In order to actually convert CONTROL to vcpkg.json, we'd need to
rename the qt5 `default` feature.
- We need to add support for $directives in x-format-manifest
* fix qt5 port
* format
* fix compile
* fix tests for canonicalization
* Clean up code
* add error message for nothing to format
* add extra_info field
* add `const X&` overloads for `Object::insert[_or_replace]`
* fix compile
* simple CRs
* add tests
* format
* Fix mosquitto port file
also unmerge a line
* fail the tests on malformed manifest
* fix format_all
* fix coroutine port-version
* format manifests
Diffstat (limited to 'toolsrc/src/vcpkg-test/json.cpp')
| -rw-r--r-- | toolsrc/src/vcpkg-test/json.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/toolsrc/src/vcpkg-test/json.cpp b/toolsrc/src/vcpkg-test/json.cpp index 90a3537ab..0b9941861 100644 --- a/toolsrc/src/vcpkg-test/json.cpp +++ b/toolsrc/src/vcpkg-test/json.cpp @@ -80,6 +80,49 @@ TEST_CASE ("JSON parse strings", "[json]") REQUIRE(res.get()->first.string() == grin); } +TEST_CASE ("JSON parse strings with escapes", "[json]") +{ + auto res = Json::parse(R"("\t")"); + REQUIRE(res); + REQUIRE(res.get()->first.is_string()); + REQUIRE(res.get()->first.string() == "\t"); + + res = Json::parse(R"("\\")"); + REQUIRE(res); + REQUIRE(res.get()->first.is_string()); + REQUIRE(res.get()->first.string() == "\\"); + + res = Json::parse(R"("\/")"); + REQUIRE(res); + REQUIRE(res.get()->first.is_string()); + REQUIRE(res.get()->first.string() == "/"); + + res = Json::parse(R"("\b")"); + REQUIRE(res); + REQUIRE(res.get()->first.is_string()); + REQUIRE(res.get()->first.string() == "\b"); + + res = Json::parse(R"("\f")"); + REQUIRE(res); + REQUIRE(res.get()->first.is_string()); + REQUIRE(res.get()->first.string() == "\f"); + + res = Json::parse(R"("\n")"); + REQUIRE(res); + REQUIRE(res.get()->first.is_string()); + REQUIRE(res.get()->first.string() == "\n"); + + res = Json::parse(R"("\r")"); + REQUIRE(res); + REQUIRE(res.get()->first.is_string()); + REQUIRE(res.get()->first.string() == "\r"); + + res = Json::parse(R"("This is a \"test\", hopefully it worked")"); + REQUIRE(res); + REQUIRE(res.get()->first.is_string()); + REQUIRE(res.get()->first.string() == R"(This is a "test", hopefully it worked)"); +} + TEST_CASE ("JSON parse integers", "[json]") { auto res = Json::parse("0"); |
