enable-on-demand-resources has YES/NO argument

This commit is contained in:
Marc Salem 2016-06-06 17:13:07 -07:00 committed by Grant Paul
parent a8f02e7b34
commit 7ebc1a4acd
2 changed files with 18 additions and 1 deletions

View File

@ -72,7 +72,7 @@ parseArgument(std::vector<std::string> const &args, std::vector<std::string>::co
} else if (arg == "--launch-image") {
return libutil::Options::NextString(&_launchImage, args, it);
} else if (arg == "--enable-on-demand-resources") {
return libutil::Options::MarkBool(&_enableOnDemandResources, arg);
return libutil::Options::NextBool(&_enableOnDemandResources, args, it, true);
} else if (arg == "--enable-incremental-distill") {
return libutil::Options::MarkBool(&_enableIncrementalDistill, arg);
} else if (arg == "--target-name") {

View File

@ -19,3 +19,20 @@ TEST(Options, InvalidDocumentedOptions)
EXPECT_FALSE(result1.first);
}
TEST(Options, OnDemandResourcesFlag)
{
Options invalid;
auto result1 = libutil::Options::Parse<Options>(&invalid, { "--enable-on-demand-resources" });
EXPECT_FALSE(result1.first);
Options yes;
auto result2 = libutil::Options::Parse<Options>(&yes, { "--enable-on-demand-resources", "YES" });
EXPECT_TRUE(result2.first);
EXPECT_TRUE(yes.enableOnDemandResources());
Options no;
auto result3 = libutil::Options::Parse<Options>(&no, { "--enable-on-demand-resources", "NO" });
EXPECT_TRUE(result3.first);
EXPECT_FALSE(no.enableOnDemandResources());
}