Skip to content

Commit a69b0ea

Browse files
jnthntatumcopybara-github
authored andcommitted
More macos test fixes.
PiperOrigin-RevId: 899776008
1 parent 7a37461 commit a69b0ea

3 files changed

Lines changed: 28 additions & 19 deletions

File tree

env/env_yaml.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ void EmitVariableConfigs(const Config& env_config, YAML::Emitter& out) {
882882
case ConstantKindCase::kTimestamp:
883883
out << YAML::Key << "value" << YAML::Value;
884884
out << absl::FormatTime(
885-
"%4Y-%2m-%2d%ET%2H:%2M:%E*SZ",
885+
"%Y-%m-%d%ET%H:%M:%E*SZ",
886886
// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
887887
constant.timestamp_value(), absl::UTCTimeZone());
888888
break;

env/env_yaml_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,8 @@ INSTANTIATE_TEST_SUITE_P(
880880
}));
881881

882882
std::string Unindent(std::string_view yaml) {
883-
std::vector<std::string> lines = absl::StrSplit(yaml, '\n');
883+
absl::string_view yaml_view = yaml;
884+
std::vector<std::string> lines = absl::StrSplit(yaml_view, '\n');
884885
int indent = -1;
885886
std::vector<std::string> unindented_lines;
886887
for (auto& line : lines) {

eval/public/builtin_func_test.cc

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -750,22 +750,25 @@ TEST_F(BuiltinsTest, TestBytesConversions_string) {
750750

751751
TEST_F(BuiltinsTest, TestDoubleConversions_double) {
752752
double ref = 100.1;
753-
TestTypeConverts(builtin::kDouble, CelValue::CreateDouble(ref), 100.1);
753+
TestTypeConverts(builtin::kDouble, CelValue::CreateDouble(ref),
754+
double{100.1});
754755
}
755756

756757
TEST_F(BuiltinsTest, TestDoubleConversions_int) {
757758
int64_t ref = 100L;
758-
TestTypeConverts(builtin::kDouble, CelValue::CreateInt64(ref), 100.0);
759+
TestTypeConverts(builtin::kDouble, CelValue::CreateInt64(ref), double{100.0});
759760
}
760761

761762
TEST_F(BuiltinsTest, TestDoubleConversions_string) {
762763
std::string ref = "-100.1";
763-
TestTypeConverts(builtin::kDouble, CelValue::CreateString(&ref), -100.1);
764+
TestTypeConverts(builtin::kDouble, CelValue::CreateString(&ref),
765+
double{-100.1});
764766
}
765767

766768
TEST_F(BuiltinsTest, TestDoubleConversions_uint) {
767769
uint64_t ref = 100UL;
768-
TestTypeConverts(builtin::kDouble, CelValue::CreateUint64(ref), 100.0);
770+
TestTypeConverts(builtin::kDouble, CelValue::CreateUint64(ref),
771+
double{100.0});
769772
}
770773

771774
TEST_F(BuiltinsTest, TestDoubleConversionError_stringInvalid) {
@@ -774,34 +777,36 @@ TEST_F(BuiltinsTest, TestDoubleConversionError_stringInvalid) {
774777
}
775778

776779
TEST_F(BuiltinsTest, TestDynConversions) {
777-
TestTypeConverts(builtin::kDyn, CelValue::CreateDouble(100.1), 100.1);
778-
TestTypeConverts(builtin::kDyn, CelValue::CreateInt64(100L), 100L);
779-
TestTypeConverts(builtin::kDyn, CelValue::CreateUint64(100UL), 100UL);
780+
TestTypeConverts(builtin::kDyn, CelValue::CreateDouble(100.1), double{100.1});
781+
TestTypeConverts(builtin::kDyn, CelValue::CreateInt64(100L), int64_t{100L});
782+
TestTypeConverts(builtin::kDyn, CelValue::CreateUint64(100UL),
783+
uint64_t{100UL});
780784
}
781785

782786
TEST_F(BuiltinsTest, TestIntConversions_int) {
783-
TestTypeConverts(builtin::kInt, CelValue::CreateInt64(100L), 100L);
787+
TestTypeConverts(builtin::kInt, CelValue::CreateInt64(100L), int64_t{100L});
784788
}
785789

786790
TEST_F(BuiltinsTest, TestIntConversions_Timestamp) {
787791
Timestamp ref;
788792
ref.set_seconds(100);
789-
TestTypeConverts(builtin::kInt, CelProtoWrapper::CreateTimestamp(&ref), 100L);
793+
TestTypeConverts(builtin::kInt, CelProtoWrapper::CreateTimestamp(&ref),
794+
int64_t{100L});
790795
}
791796

792797
TEST_F(BuiltinsTest, TestIntConversions_double) {
793798
double ref = 100.1;
794-
TestTypeConverts(builtin::kInt, CelValue::CreateDouble(ref), 100L);
799+
TestTypeConverts(builtin::kInt, CelValue::CreateDouble(ref), int64_t{100L});
795800
}
796801

797802
TEST_F(BuiltinsTest, TestIntConversions_string) {
798803
std::string ref = "100";
799-
TestTypeConverts(builtin::kInt, CelValue::CreateString(&ref), 100L);
804+
TestTypeConverts(builtin::kInt, CelValue::CreateString(&ref), int64_t{100L});
800805
}
801806

802807
TEST_F(BuiltinsTest, TestIntConversions_uint) {
803808
uint64_t ref = 100;
804-
TestTypeConverts(builtin::kInt, CelValue::CreateUint64(ref), 100L);
809+
TestTypeConverts(builtin::kInt, CelValue::CreateUint64(ref), int64_t{100L});
805810
}
806811

807812
TEST_F(BuiltinsTest, TestIntConversions_doubleIntMin) {
@@ -826,7 +831,7 @@ TEST_F(BuiltinsTest, TestIntConversionError_doubleIntMaxMinus512) {
826831
// value, but it will rountrip to a valid 64-bit integer.
827832
double range = std::numeric_limits<int64_t>::max() - 512;
828833
TestTypeConverts(builtin::kInt, CelValue::CreateDouble(range),
829-
std::numeric_limits<int64_t>::max() - 1023);
834+
int64_t{std::numeric_limits<int64_t>::max() - 1023});
830835
}
831836

832837
TEST_F(BuiltinsTest, TestIntConversionError_doubleNegRange) {
@@ -874,21 +879,24 @@ TEST_F(BuiltinsTest, TestIntConversionError_uintRange) {
874879

875880
TEST_F(BuiltinsTest, TestUintConversions_double) {
876881
double ref = 100.1;
877-
TestTypeConverts(builtin::kUint, CelValue::CreateDouble(ref), 100UL);
882+
TestTypeConverts(builtin::kUint, CelValue::CreateDouble(ref),
883+
uint64_t{100UL});
878884
}
879885

880886
TEST_F(BuiltinsTest, TestUintConversions_int) {
881887
int64_t ref = 100L;
882-
TestTypeConverts(builtin::kUint, CelValue::CreateInt64(ref), 100UL);
888+
TestTypeConverts(builtin::kUint, CelValue::CreateInt64(ref), uint64_t{100UL});
883889
}
884890

885891
TEST_F(BuiltinsTest, TestUintConversions_string) {
886892
std::string ref = "100";
887-
TestTypeConverts(builtin::kUint, CelValue::CreateString(&ref), 100UL);
893+
TestTypeConverts(builtin::kUint, CelValue::CreateString(&ref),
894+
uint64_t{100UL});
888895
}
889896

890897
TEST_F(BuiltinsTest, TestUintConversions_uint) {
891-
TestTypeConverts(builtin::kUint, CelValue::CreateUint64(100UL), 100UL);
898+
TestTypeConverts(builtin::kUint, CelValue::CreateUint64(uint64_t{100UL}),
899+
uint64_t{100UL});
892900
}
893901

894902
TEST_F(BuiltinsTest, TestUintConversionError_doubleNegRange) {

0 commit comments

Comments
 (0)