Skip to content

Commit

Permalink
fill/proto/interactive_filler_test: fix
Browse files Browse the repository at this point in the history
This test actually didn't succeed properly, but we didn't notice, as the
error wasn't propagated properly.
  • Loading branch information
flokli committed Feb 25, 2023
1 parent 2588f1d commit f7bd8d2
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions fill/proto/interactive_filler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ func TestInteractiveFiller(t *testing.T) {
b.AddField(builder.NewField("o", builder.FieldTypeBool()))
b.AddField(builder.NewField("p", builder.FieldTypeString()))
b.AddField(builder.NewField("q", builder.FieldTypeBytes()))
b.AddField(builder.NewField("r", builder.FieldTypeBytes()))
b.AddField(builder.NewField("s", builder.FieldTypeBytes()))
m, err := b.Build()
if err != nil {
t.Fatalf("Build should not return an error, but got '%s'", err)
Expand All @@ -87,23 +85,21 @@ func TestInteractiveFiller(t *testing.T) {
p := &stubPrompt{
t: t,
input: []string{
"1.1", // c
"1.2", // d
"1", // e
"2", // f
"3", // g
"4", // h
"5", // i
"6", // j
"7", // k
"8", // l
"9", // m
"10", // n
"true", // o
"foo", // p
"bar", // q
"\x62\x61\x7a", // r
"./proto.go", // s
"1.1", // c
"1.2", // d
"1", // e
"2", // f
"3", // g
"4", // h
"5", // i
"6", // j
"7", // k
"8", // l
"9", // m
"10", // n
"true", // o
"foo", // p
"./proto.go", // q
},
selection: []int{
0, // a - yes
Expand All @@ -121,7 +117,7 @@ func TestInteractiveFiller(t *testing.T) {
return
}

const want = `{"a":[{}],"b":"enum2","c":1.1,"d":1.2,"e":"1","f":"2","g":"3","h":"4","i":"5","j":6,"k":7,"l":8,"m":9,"n":10,"o":true,"p":"foo","q":"YmFy","r":"YmF6","s":"Ly8gUGFja2FnZSBwcm90byBwcm92aWRlcyBhIGZpbGxlciBpbXBsZW1lbnRhdGlvbiBmb3IgUHJvdG9jb2wgQnVmZmVycy4KcGFja2FnZSBwcm90bwo="}`
const want = `{"a":[{}],"b":"enum2","c":1.1,"d":1.2,"e":"1","f":"2","g":"3","h":"4","i":"5","j":6,"k":7,"l":8,"m":9,"n":10,"o":true,"p":"foo","q":"Ly8gUGFja2FnZSBwcm90byBwcm92aWRlcyBhIGZpbGxlciBpbXBsZW1lbnRhdGlvbiBmb3IgUHJvdG9jb2wgQnVmZmVycy4KcGFja2FnZSBwcm90bwo="}`

marshaler := jsonpb.Marshaler{EmitDefaults: true}
got, err := marshaler.MarshalToString(msg)
Expand Down

0 comments on commit f7bd8d2

Please sign in to comment.