From 0b1bbd04208bb18573e1702392ca3844903bb4d0 Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Wed, 25 Sep 2024 12:42:59 -0700 Subject: [PATCH] =?UTF-8?q?Fix=20the=20unit=20tests=20for=20"hypens"=20?= =?UTF-8?q?=F0=9F=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/vcpkg-test/input.cpp | 21 ++++++++++++++------- src/vcpkg-test/manifests.cpp | 12 ++++++------ src/vcpkg-test/specifier.cpp | 16 ++++++++-------- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/vcpkg-test/input.cpp b/src/vcpkg-test/input.cpp index 886acd4697..da14590da7 100644 --- a/src/vcpkg-test/input.cpp +++ b/src/vcpkg-test/input.cpp @@ -81,7 +81,7 @@ TEST_CASE ("parse_package_spec forbid illegal characters", "[input][parse_packag { REQUIRE( maybe_parsed.error() == - R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hypens. + R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hyphens. on expression: zlib#notaport ^)"); } @@ -111,10 +111,17 @@ TEST_CASE ("check_triplet rejects malformed triplet", "[input][check_triplet]") db.available_triplets.push_back(TripletFile{"invalid.triplet_name", "invalid.triplet_name.cmake"}); auto maybe_check = check_triplet("invalid.triplet_name", db); REQUIRE(!maybe_check.has_value()); - static constexpr StringLiteral expected_error{ - "error: expected the end of input parsing a package spec; this usually means the indicated character is not " - "allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hypens."}; - REQUIRE(maybe_check.error() == expected_error); + REQUIRE(!maybe_check.has_value()); + REQUIRE(maybe_check.error().data() == + R"(error: Invalid triplet name. Triplet names are all lowercase alphanumeric+hyphens. + on expression: invalid.triplet_name + ^ +Built-in Triplets: +Community Triplets: +Overlay Triplets from "invalid.triplet_name.cmake": + invalid.triplet_name +See https://learn.microsoft.com/vcpkg/users/triplets?WT.mc_id=vcpkg_inproduct_cli for more information. +)"); } TEST_CASE ("check_and_get_package_spec validates the triplet", "[input][check_and_get_package_spec]") @@ -153,7 +160,7 @@ TEST_CASE ("check_and_get_package_spec forbids malformed", "[input][check_and_ge REQUIRE( maybe_spec.error() == LocalizedString::from_raw( - R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hypens. + R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hyphens. on expression: zlib:x86-windows# ^)")); } @@ -222,7 +229,7 @@ TEST_CASE ("check_and_get_full_package_spec forbids malformed", "[input][check_a REQUIRE( maybe_spec.error() == LocalizedString::from_raw( - R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hypens. + R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hyphens. on expression: zlib[core]:x86-windows# ^)")); } diff --git a/src/vcpkg-test/manifests.cpp b/src/vcpkg-test/manifests.cpp index b144968e52..bbb20e0712 100644 --- a/src/vcpkg-test/manifests.cpp +++ b/src/vcpkg-test/manifests.cpp @@ -1419,7 +1419,7 @@ TEST_CASE ("default-feature-empty errors", "[manifests]") REQUIRE(!m_pgh.has_value()); REQUIRE(m_pgh.error().data() == ": error: $.default-features[0] (a feature name): \"\" is not a valid feature name. Feature " - "names must be lowercase alphanumeric+hypens and not reserved (see " + + "names must be lowercase alphanumeric+hyphens and not reserved (see " + docs::manifests_url + " for more information)."); } @@ -1432,7 +1432,7 @@ TEST_CASE ("default-feature-empty-object errors", "[manifests]") REQUIRE(!m_pgh.has_value()); REQUIRE(m_pgh.error().data() == ": error: $.default-features[0].name (a feature name): \"\" is not a valid feature name. " - "Feature names must be lowercase alphanumeric+hypens and not reserved (see " + + "Feature names must be lowercase alphanumeric+hyphens and not reserved (see " + docs::manifests_url + " for more information)."); } @@ -1445,7 +1445,7 @@ TEST_CASE ("dependency-name-empty errors", "[manifests]") REQUIRE(!m_pgh.has_value()); REQUIRE(m_pgh.error().data() == ": error: $.dependencies[0] (a package name): \"\" is not a valid package name. Package " - "names must be lowercase alphanumeric+hypens and not reserved (see " + + "names must be lowercase alphanumeric+hyphens and not reserved (see " + docs::manifests_url + " for more information)."); } @@ -1458,7 +1458,7 @@ TEST_CASE ("dependency-name-empty-object errors", "[manifests]") REQUIRE(!m_pgh.has_value()); REQUIRE(m_pgh.error().data() == ": error: $.dependencies[0].name (a package name): \"\" is not a valid package name. " - "Package names must be lowercase alphanumeric+hypens and not reserved (see " + + "Package names must be lowercase alphanumeric+hyphens and not reserved (see " + docs::manifests_url + " for more information)."); } @@ -1545,7 +1545,7 @@ TEST_CASE ("dependency-feature-name-empty errors", "[manifests]") REQUIRE(!m_pgh.has_value()); REQUIRE(m_pgh.error().data() == ": error: $.dependencies[0].features[0] (a feature name): \"\" is not a valid feature name. " - "Feature names must be lowercase alphanumeric+hypens and not reserved (see " + + "Feature names must be lowercase alphanumeric+hyphens and not reserved (see " + docs::manifests_url + " for more information)."); } @@ -1563,6 +1563,6 @@ TEST_CASE ("dependency-feature-name-empty-object errors", "[manifests]") REQUIRE(!m_pgh.has_value()); REQUIRE(m_pgh.error().data() == ": error: $.dependencies[0].features[0].name (a feature name): \"\" is not a valid feature " - "name. Feature names must be lowercase alphanumeric+hypens and not reserved (see " + + "name. Feature names must be lowercase alphanumeric+hyphens and not reserved (see " + docs::manifests_url + " for more information)."); } diff --git a/src/vcpkg-test/specifier.cpp b/src/vcpkg-test/specifier.cpp index 4cf01825b3..9db6f1fa5e 100644 --- a/src/vcpkg-test/specifier.cpp +++ b/src/vcpkg-test/specifier.cpp @@ -98,7 +98,7 @@ TEST_CASE ("specifier parsing", "[specifier]") REQUIRE( s.error() == LocalizedString::from_raw( - R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hypens. + R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hyphens. on expression: zlib:x86-uwp: ^)")); } @@ -119,7 +119,7 @@ TEST_CASE ("specifier parsing", "[specifier]") REQUIRE( s.error() == LocalizedString::from_raw( - R"(error: expected the end of input parsing a package name; this usually means the indicated character is not allowed to be in a port name. Port names are all lowercase alphanumeric+hypens and not reserved (see )" + + R"(error: expected the end of input parsing a package name; this usually means the indicated character is not allowed to be in a port name. Port names are all lowercase alphanumeric+hyphens and not reserved (see )" + docs::vcpkg_json_ref_name + R"( for more information). on expression: zlib# ^)")); @@ -139,7 +139,7 @@ TEST_CASE ("specifier parsing", "[specifier]") REQUIRE( s.error() == LocalizedString::from_raw( - R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hypens. + R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hyphens. on expression: zlib# ^)")); } @@ -158,7 +158,7 @@ TEST_CASE ("specifier parsing", "[specifier]") REQUIRE( s.error() == LocalizedString::from_raw( - R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hypens. + R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hyphens. on expression: zlib:x86-uwp: ^)")); } @@ -196,7 +196,7 @@ TEST_CASE ("specifier parsing", "[specifier]") REQUIRE( s.error() == LocalizedString::from_raw( - R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hypens. + R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hyphens. on expression: zlib(windows)[co, re] ^)")); } @@ -215,7 +215,7 @@ TEST_CASE ("specifier parsing", "[specifier]") REQUIRE( s.error() == LocalizedString::from_raw( - R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hypens. + R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hyphens. on expression: zlib:x86-uwp (windows)[co, re] ^)")); } @@ -238,7 +238,7 @@ TEST_CASE ("specifier parsing", "[specifier]") REQUIRE( s.error() == LocalizedString::from_raw( - R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hypens. + R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hyphens. on expression: zlib:x64-windows[no-ending-square-bracket ^)")); } @@ -257,7 +257,7 @@ TEST_CASE ("specifier parsing", "[specifier]") REQUIRE( s.error() == LocalizedString::from_raw( - R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hypens. + R"(error: expected the end of input parsing a package spec; this usually means the indicated character is not allowed to be in a package spec. Port, triplet, and feature names are all lowercase alphanumeric+hyphens. on expression: zlib:x64-windows[feature]suffix ^)")); }