Skip to content

Commit

Permalink
fml again
Browse files Browse the repository at this point in the history
  • Loading branch information
jhump committed Aug 28, 2024
1 parent ec480ba commit 4a12b2f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 35 deletions.
10 changes: 5 additions & 5 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ func TestEditions(t *testing.T) {
Nested: &testv1.EditionsTest_Nested{
Ids: []int64{0, 1, 1, 2, 3, 5, 8},
},
Enum: testv1.OpenEnum_OPEN_ENUM_ZERO,
Enum: testv1.OpenEnum_OPEN_ENUM_UNSPECIFIED,
}
actual := &testv1.EditionsTest{}
data := []byte(`
name: "foobar"
enum: OPEN_ENUM_ZERO
enum: OPEN_ENUM_UNSPECIFIED
nested:
ids: [0, 1, 1, 2, 3, 5, 8]`)
err := Unmarshal(data, actual)
Expand All @@ -125,13 +125,13 @@ func TestRequiredFields(t *testing.T) {
t.Parallel()

actual := &testv1.EditionsTest{}
err := Unmarshal([]byte(`enum: OPEN_ENUM_ZERO`), actual)
err := Unmarshal([]byte(`enum: OPEN_ENUM_UNSPECIFIED`), actual)
require.ErrorContains(t, err, "required field buf.protoyaml.test.v1.EditionsTest.name not set")

err = UnmarshalOptions{AllowPartial: true}.Unmarshal([]byte(`enum: OPEN_ENUM_ZERO`), actual)
err = UnmarshalOptions{AllowPartial: true}.Unmarshal([]byte(`enum: OPEN_ENUM_UNSPECIFIED`), actual)
require.NoError(t, err)
expected := &testv1.EditionsTest{
Enum: testv1.OpenEnum_OPEN_ENUM_ZERO,
Enum: testv1.OpenEnum_OPEN_ENUM_UNSPECIFIED,
}
require.Empty(t, cmp.Diff(expected, actual, protocmp.Transform()))
}
Expand Down
57 changes: 29 additions & 28 deletions internal/gen/proto/buf/protoyaml/test/v1/editions.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/proto/buf/protoyaml/test/v1/editions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ message EditionsTest {
}

enum OpenEnum {
OPEN_ENUM_ZERO = 0;
OPEN_ENUM_UNSPECIFIED = 0;
}

enum ClosedEnum {
option features.enum_type=CLOSED;
CLOSED_ENUM_ZERO = 0;
CLOSED_ENUM_UNSPECIFIED = 0;
}

0 comments on commit 4a12b2f

Please sign in to comment.