All-CAPS for enum members

This commit is contained in:
Alexander Karatarakis 2016-10-04 14:48:39 -07:00
parent bf323e8cc6
commit 7d13495cf9
4 changed files with 11 additions and 11 deletions

View File

@ -5,9 +5,9 @@ namespace vcpkg
{
enum class package_spec_parse_result
{
success = 0,
too_many_colons,
invalid_characters
SUCCESS = 0,
TOO_MANY_COLONS,
INVALID_CHARACTERS
};
struct package_spec_parse_result_category_impl final : std::error_category

View File

@ -19,7 +19,7 @@ namespace vcpkg
auto pos2 = spec_as_string.find(':', pos + 1);
if (pos2 != std::string::npos)
{
return std::error_code(package_spec_parse_result::too_many_colons);
return std::error_code(package_spec_parse_result::TOO_MANY_COLONS);
}
const std::string name = spec_as_string.substr(0, pos);
@ -31,7 +31,7 @@ namespace vcpkg
{
if (std::find_if_not(name.cbegin(), name.cend(), is_valid_package_spec_char) != name.end())
{
return std::error_code(package_spec_parse_result::invalid_characters);
return std::error_code(package_spec_parse_result::INVALID_CHARACTERS);
}
package_spec p;

View File

@ -13,11 +13,11 @@ namespace vcpkg
{
switch (static_cast<package_spec_parse_result>(ev))
{
case package_spec_parse_result::success:
case package_spec_parse_result::SUCCESS:
return "OK";
case package_spec_parse_result::too_many_colons:
case package_spec_parse_result::TOO_MANY_COLONS:
return "Too many colons";
case package_spec_parse_result::invalid_characters:
case package_spec_parse_result::INVALID_CHARACTERS:
return "Contains invalid characters. Only alphanumeric ASCII characters and dashes are allowed";
default:
Checks::unreachable();

View File

@ -309,7 +309,7 @@ namespace UnitTest1
TEST_METHOD(package_spec_parse)
{
vcpkg::expected<vcpkg::package_spec> spec = vcpkg::package_spec::from_string("zlib", vcpkg::triplet::X86_WINDOWS);
Assert::AreEqual(vcpkg::package_spec_parse_result::success, vcpkg::to_package_spec_parse_result(spec.error_code()));
Assert::AreEqual(vcpkg::package_spec_parse_result::SUCCESS, vcpkg::to_package_spec_parse_result(spec.error_code()));
Assert::AreEqual("zlib", spec.get()->name().c_str());
Assert::AreEqual(vcpkg::triplet::X86_WINDOWS.canonical_name(), spec.get()->target_triplet().canonical_name());
}
@ -317,7 +317,7 @@ namespace UnitTest1
TEST_METHOD(package_spec_parse_with_arch)
{
vcpkg::expected<vcpkg::package_spec> spec = vcpkg::package_spec::from_string("zlib:x64-uwp", vcpkg::triplet::X86_WINDOWS);
Assert::AreEqual(vcpkg::package_spec_parse_result::success, vcpkg::to_package_spec_parse_result(spec.error_code()));
Assert::AreEqual(vcpkg::package_spec_parse_result::SUCCESS, vcpkg::to_package_spec_parse_result(spec.error_code()));
Assert::AreEqual("zlib", spec.get()->name().c_str());
Assert::AreEqual(vcpkg::triplet::X64_UWP.canonical_name(), spec.get()->target_triplet().canonical_name());
}
@ -325,7 +325,7 @@ namespace UnitTest1
TEST_METHOD(package_spec_parse_with_multiple_colon)
{
auto ec = vcpkg::package_spec::from_string("zlib:x86-uwp:", vcpkg::triplet::X86_WINDOWS).error_code();
Assert::AreEqual(vcpkg::package_spec_parse_result::too_many_colons, vcpkg::to_package_spec_parse_result(ec));
Assert::AreEqual(vcpkg::package_spec_parse_result::TOO_MANY_COLONS, vcpkg::to_package_spec_parse_result(ec));
}
TEST_METHOD(utf8_to_utf16)