Fix getting env variables on windows

pull/15518/head
Isuru Fernando 1 year ago
parent f0ccf26e63
commit fac673bae3
  1. 8
      src/google/protobuf/compiler/mock_code_generator.cc

@ -72,7 +72,13 @@ static constexpr absl::string_view kSecondInsertionPoint =
" # @@protoc_insertion_point(second_mock_insertion_point) is here\n";
MockCodeGenerator::MockCodeGenerator(absl::string_view name) : name_(name) {
absl::string_view key = getenv("TEST_CASE");
char* c_key = getenv("TEST_CASE");
if (c_key == NULL) {
// In Windows, setting 'TEST_CASE=' is equivalent to unsetting
// and therefore c_key can be NULL
c_key = "";
}
absl::string_view key(c_key);
if (key == "no_editions") {
suppressed_features_ |= CodeGenerator::FEATURE_SUPPORTS_EDITIONS;
} else if (key == "invalid_features") {

Loading…
Cancel
Save