Skip to content

Commit

Permalink
Delete unused BlazeUtil#SearchNullaryOptionEverywhere.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 169370539
  • Loading branch information
lfpino authored and laszlocsomor committed Sep 20, 2017
1 parent ba34494 commit aa1541b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 58 deletions.
5 changes: 0 additions & 5 deletions src/main/cpp/blaze_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,6 @@ bool SearchNullaryOption(const vector<string>& args, const char *key) {
return SearchNullaryOption(args, key, false);
}

bool SearchNullaryOptionEverywhere(const vector<string>& args,
const char *key) {
return SearchNullaryOption(args, key, true);
}

bool VerboseLogging() { return !GetEnv("VERBOSE_BLAZE_CLIENT").empty(); }

// Read the Jvm version from a file descriptor. The read fd
Expand Down
11 changes: 1 addition & 10 deletions src/main/cpp/blaze_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,11 @@ const char* SearchUnaryOption(const std::vector<std::string>& args,
const char* key);

// Searches for 'key' in 'args' using GetNullaryOption.
// Unlike SearchNullaryOptionEverywhere, arguments found after '--' are omitted
// from the search.
// Arguments found after '--' are omitted from the search.
// Returns true iff key is a flag in args.
bool SearchNullaryOption(const std::vector<std::string>& args,
const char* key);

// Searches for 'key' in 'args' using GetNullaryOption.
// Unlike SearchNullaryOption, arguments found after '--' are included in the
// search.
// Returns true iff key is a flag in args.
bool SearchNullaryOptionEverywhere(const std::vector<std::string>& args,
const char* key);


// Enable messages mostly of interest to developers.
bool VerboseLogging();

Expand Down
43 changes: 0 additions & 43 deletions src/test/cpp/blaze_util_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,49 +202,6 @@ TEST_F(BlazeUtilTest, TestSearchNullarySucceedsWithEqualsAndDashDash) {
{"bazel", "build", ":target", "--", "--flag=value"}, "--flag"));
}

TEST_F(BlazeUtilTest, TestSearchNullaryEverywhereEmptyCase) {
ASSERT_FALSE(SearchNullaryOptionEverywhere({}, "--flag"));
}

TEST_F(BlazeUtilTest, TestSearchNullaryEverywhereForEmpty) {
ASSERT_FALSE(SearchNullaryOptionEverywhere(
{"bazel", "build", ":target", "--"}, ""));
}

TEST_F(BlazeUtilTest, TestSearchNullaryEverywhereForFlagNotPresent) {
ASSERT_FALSE(SearchNullaryOptionEverywhere(
{"bazel", "build", ":target", "--"}, "--flag"));
}

TEST_F(BlazeUtilTest, TestSearchNullaryEverywhereStartupOption) {
ASSERT_TRUE(SearchNullaryOptionEverywhere(
{"bazel", "--flag", "build", ":target", "--"}, "--flag"));
}

TEST_F(BlazeUtilTest, TestSearchNullaryEverywhereStartupOptionWithEquals) {
ASSERT_DEATH(SearchNullaryOptionEverywhere(
{"bazel", "--flag=value", "build", ":target", "--"}, "--flag"),
"In argument '--flag=value': option "
"'--flag' does not take a value");
}

TEST_F(BlazeUtilTest, TestSearchNullaryEverywhereCommandOption) {
ASSERT_TRUE(SearchNullaryOptionEverywhere(
{"bazel", "build", ":target", "--flag"}, "--flag"));
}

TEST_F(BlazeUtilTest, TestSearchNullaryEverywhereReadsAfterPositionalParams) {
ASSERT_TRUE(SearchNullaryOptionEverywhere(
{"bazel", "build", ":target", "--", "--flag"}, "--flag"));
}

TEST_F(BlazeUtilTest, TestSearchNullaryEverywhereFailsAfterPositionalParams) {
ASSERT_DEATH(SearchNullaryOptionEverywhere(
{"bazel", "build", ":target", "--", "--flag=value"}, "--flag"),
"In argument '--flag=value': option "
"'--flag' does not take a value");
}

TEST_F(BlazeUtilTest, TestSearchUnaryForEmpty) {
ASSERT_STREQ(nullptr, SearchUnaryOption({"bazel", "build", ":target"}, ""));
}
Expand Down

0 comments on commit aa1541b

Please sign in to comment.