@@ -408,6 +408,47 @@ func TestLenientParse_EmptyCompactOptions(t *testing.T) {
408408 }
409409}
410410
411+ func TestLenientParse_EmptyCompactValue (t * testing.T ) {
412+ t .Parallel ()
413+ inputs := map [string ]struct {
414+ Error string
415+ NoError string
416+ }{
417+ "field-options" : {
418+ Error : `syntax = "proto2";
419+ message Foo {
420+ optional int32 bar = 1 [deprecated=true, default];
421+ }` ,
422+ NoError : `syntax = "proto3";
423+ message Foo {
424+ optional int32 bar = 1 [deprecated=true, default=1];
425+ }` ,
426+ },
427+ "enum-options" : {
428+ Error : `syntax = "proto3";
429+ enum Foo {
430+ FOO = 0 [deprecated];
431+ }` ,
432+ NoError : `syntax = "proto3";
433+ enum Foo {
434+ FOO = 0 [deprecated=true];
435+ }` ,
436+ },
437+ }
438+ for name , input := range inputs {
439+ name , input := name , input
440+ t .Run (name , func (t * testing.T ) {
441+ t .Parallel ()
442+ errHandler := reporter .NewHandler (nil )
443+ protoName := fmt .Sprintf ("%s.proto" , name )
444+ _ , err := Parse (protoName , strings .NewReader (input .NoError ), errHandler )
445+ require .NoError (t , err )
446+ _ , err = Parse (protoName , strings .NewReader (input .Error ), errHandler )
447+ require .ErrorContains (t , err , "compact option must have a value" )
448+ })
449+ }
450+ }
451+
411452func TestSimpleParse (t * testing.T ) {
412453 t .Parallel ()
413454 protos := map [string ]Result {}
0 commit comments