forked from planetscale/vtprotobuf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
planetscale#130 did not correctly account for the key size impacting the size. This fixes the original PR, and adds another test case to cover the issue
- Loading branch information
1 parent
0393e58
commit 9cfb335
Showing
5 changed files
with
28 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
package conformance | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/planetscale/vtprotobuf/types/known/structpb" | ||
"github.com/stretchr/testify/require" | ||
"google.golang.org/protobuf/proto" | ||
upstreamstructpb "google.golang.org/protobuf/types/known/structpb" | ||
"testing" | ||
) | ||
|
||
func TestEmptyOneoff(t *testing.T) { | ||
func TestEmptyOneof(t *testing.T) { | ||
// Regression test for https://github.com/planetscale/vtprotobuf/issues/61 | ||
msg := &TestAllTypesProto3{OneofField: &TestAllTypesProto3_OneofNestedMessage{}} | ||
upstream, _ := proto.Marshal(msg) | ||
vt, _ := msg.MarshalVTStrict() | ||
require.Equal(t, upstream, vt) | ||
t.Run("all proto", func(t *testing.T) { | ||
msg := &TestAllTypesProto3{OneofField: &TestAllTypesProto3_OneofNestedMessage{}} | ||
upstream, _ := proto.Marshal(msg) | ||
vt, _ := msg.MarshalVTStrict() | ||
require.Equal(t, upstream, vt) | ||
}) | ||
t.Run("structpb", func(t *testing.T) { | ||
msg := &structpb.Value{Kind: &upstreamstructpb.Value_StructValue{}} | ||
upstream, _ := proto.Marshal((*upstreamstructpb.Value)(msg)) | ||
vt, _ := msg.MarshalVTStrict() | ||
require.Equal(t, upstream, vt) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.