mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 07:19:24 +08:00
Formatting + add test to the vcxproj
This commit is contained in:
parent
4302675092
commit
924de7c5fe
@ -78,9 +78,9 @@ namespace vcpkg
|
||||
|
||||
if (arg[0] == '-' && arg[1] == '-')
|
||||
{
|
||||
// make argument case insensitive
|
||||
auto &f = std::use_facet<std::ctype<char>>(std::locale());
|
||||
f.tolower(&arg[0], &arg[0] + arg.size());
|
||||
// make argument case insensitive
|
||||
auto& f = std::use_facet<std::ctype<char>>(std::locale());
|
||||
f.tolower(&arg[0], &arg[0] + arg.size());
|
||||
// command switch
|
||||
if (arg == "--vcpkg-root")
|
||||
{
|
||||
|
@ -1,46 +1,46 @@
|
||||
#include "CppUnitTest.h"
|
||||
#include "VcpkgCmdArguments.h"
|
||||
|
||||
#pragma comment(lib,"version")
|
||||
#pragma comment(lib,"winhttp")
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
using namespace vcpkg;
|
||||
|
||||
namespace UnitTest1
|
||||
{
|
||||
TEST_CLASS(ArgumentTests)
|
||||
{
|
||||
public:
|
||||
TEST_METHOD(create_from_arg_sequence_options_lower)
|
||||
{
|
||||
std::vector<std::string> t = {
|
||||
"--vcpkg-root", "C:\vcpkg",
|
||||
"--debug",
|
||||
"--sendmetrics",
|
||||
"--printmetrics"
|
||||
};
|
||||
auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size());
|
||||
Assert::AreEqual("C:\vcpkg", v.vcpkg_root_dir.get()->c_str());
|
||||
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.debug);
|
||||
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.sendmetrics);
|
||||
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.printmetrics);
|
||||
}
|
||||
|
||||
TEST_METHOD(create_from_arg_sequence_options_upper)
|
||||
{
|
||||
std::vector<std::string> t = {
|
||||
"--VCPKG-ROOT", "C:\vcpkg",
|
||||
"--DEBUG",
|
||||
"--SENDMETRICS",
|
||||
"--PRINTMETRICS"
|
||||
};
|
||||
auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size());
|
||||
Assert::AreEqual("C:\vcpkg", v.vcpkg_root_dir.get()->c_str());
|
||||
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.debug);
|
||||
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.sendmetrics);
|
||||
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.printmetrics);
|
||||
}
|
||||
};
|
||||
}
|
||||
#pragma comment(lib,"version")
|
||||
#pragma comment(lib,"winhttp")
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
using namespace vcpkg;
|
||||
|
||||
namespace UnitTest1
|
||||
{
|
||||
TEST_CLASS(ArgumentTests)
|
||||
{
|
||||
public:
|
||||
TEST_METHOD(create_from_arg_sequence_options_lower)
|
||||
{
|
||||
std::vector<std::string> t = {
|
||||
"--vcpkg-root", "C:\vcpkg",
|
||||
"--debug",
|
||||
"--sendmetrics",
|
||||
"--printmetrics"
|
||||
};
|
||||
auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size());
|
||||
Assert::AreEqual("C:\vcpkg", v.vcpkg_root_dir.get()->c_str());
|
||||
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.debug);
|
||||
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.sendmetrics);
|
||||
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.printmetrics);
|
||||
}
|
||||
|
||||
TEST_METHOD(create_from_arg_sequence_options_upper)
|
||||
{
|
||||
std::vector<std::string> t = {
|
||||
"--VCPKG-ROOT", "C:\vcpkg",
|
||||
"--DEBUG",
|
||||
"--SENDMETRICS",
|
||||
"--PRINTMETRICS"
|
||||
};
|
||||
auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size());
|
||||
Assert::AreEqual("C:\vcpkg", v.vcpkg_root_dir.get()->c_str());
|
||||
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.debug);
|
||||
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.sendmetrics);
|
||||
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.printmetrics);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\tests_arguments.cpp" />
|
||||
<ClCompile Include="..\src\tests_dependencies.cpp" />
|
||||
<ClCompile Include="..\src\tests_paragraph.cpp" />
|
||||
</ItemGroup>
|
||||
|
@ -21,5 +21,8 @@
|
||||
<ClCompile Include="..\src\tests_dependencies.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\tests_arguments.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user