Skip to content

Commit bccaaa1

Browse files
authored
Add additional conformance tests targeted at wrapper types (#314)
Signed-off-by: Justin King <[email protected]>
1 parent dd5373c commit bccaaa1

File tree

7 files changed

+5121
-5042
lines changed

7 files changed

+5121
-5042
lines changed

proto/test/v1/proto2/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ proto_library(
1414
deps = [
1515
"@com_google_protobuf//:any_proto",
1616
"@com_google_protobuf//:duration_proto",
17+
"@com_google_protobuf//:empty_proto",
1718
"@com_google_protobuf//:field_mask_proto",
1819
"@com_google_protobuf//:struct_proto",
1920
"@com_google_protobuf//:timestamp_proto",
@@ -33,6 +34,7 @@ go_proto_library(
3334
deps = [
3435
"@org_golang_google_protobuf//types/known/anypb:go_default_library",
3536
"@org_golang_google_protobuf//types/known/durationpb:go_default_library",
37+
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
3638
"@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
3739
"@org_golang_google_protobuf//types/known/structpb:go_default_library",
3840
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",

proto/test/v1/proto2/test_all_types.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package google.api.expr.test.v1.proto2;
44

55
import "google/protobuf/any.proto";
66
import "google/protobuf/duration.proto";
7+
import "google/protobuf/empty.proto";
78
import "google/protobuf/field_mask.proto";
89
import "google/protobuf/struct.proto";
910
import "google/protobuf/timestamp.proto";
@@ -67,6 +68,7 @@ message TestAllTypes {
6768
optional google.protobuf.NullValue null_value = 115;
6869
optional google.protobuf.NullValue optional_null_value = 116;
6970
optional google.protobuf.FieldMask field_mask = 117;
71+
optional google.protobuf.Empty empty = 118;
7072

7173
// Nested messages
7274
oneof nested_type {

proto/test/v1/proto2/test_all_types/test_all_types.pb.go

Lines changed: 2527 additions & 2511 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/test/v1/proto3/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ proto_library(
1414
deps = [
1515
"@com_google_protobuf//:any_proto",
1616
"@com_google_protobuf//:duration_proto",
17+
"@com_google_protobuf//:empty_proto",
1718
"@com_google_protobuf//:field_mask_proto",
1819
"@com_google_protobuf//:struct_proto",
1920
"@com_google_protobuf//:timestamp_proto",
@@ -33,6 +34,7 @@ go_proto_library(
3334
deps = [
3435
"@org_golang_google_protobuf//types/known/anypb:go_default_library",
3536
"@org_golang_google_protobuf//types/known/durationpb:go_default_library",
37+
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
3638
"@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
3739
"@org_golang_google_protobuf//types/known/structpb:go_default_library",
3840
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",

proto/test/v1/proto3/test_all_types.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package google.api.expr.test.v1.proto3;
44

55
import "google/protobuf/any.proto";
66
import "google/protobuf/duration.proto";
7+
import "google/protobuf/empty.proto";
78
import "google/protobuf/field_mask.proto";
89
import "google/protobuf/struct.proto";
910
import "google/protobuf/timestamp.proto";
@@ -67,6 +68,7 @@ message TestAllTypes {
6768
google.protobuf.NullValue null_value = 115;
6869
optional google.protobuf.NullValue optional_null_value = 116;
6970
google.protobuf.FieldMask field_mask = 117;
71+
google.protobuf.Empty empty = 118;
7072

7173
// Nested messages
7274
oneof nested_type {

proto/test/v1/proto3/test_all_types/test_all_types.pb.go

Lines changed: 2547 additions & 2531 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/simple/testdata/wrappers.textproto

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,42 @@ section {
258258
}
259259
}
260260
}
261+
262+
# google.protobuf.Duration
263+
section {
264+
name: "duration"
265+
test {
266+
name: "to_json"
267+
container: "google.api.expr.test.v1.proto3"
268+
expr: "TestAllTypes{single_value: duration('1000000s')}.single_value"
269+
value {
270+
string_value: "1000000s"
271+
}
272+
}
273+
}
274+
275+
# google.protobuf.Timestamp
276+
section {
277+
name: "timestamp"
278+
test {
279+
name: "to_json"
280+
container: "google.api.expr.test.v1.proto3"
281+
expr: "TestAllTypes{single_value: timestamp('9999-12-31T23:59:59.999999999Z')}.single_value"
282+
value {
283+
string_value: "9999-12-31T23:59:59.999999999Z"
284+
}
285+
}
286+
}
287+
288+
# google.protobuf.Empty
289+
section {
290+
name: "empty"
291+
test {
292+
name: "to_json"
293+
container: "google.api.expr.test.v1.proto3"
294+
expr: "TestAllTypes{single_value: google.protobuf.Empty{}}.single_value"
295+
value {
296+
map_value {}
297+
}
298+
}
299+
}

0 commit comments

Comments
 (0)