-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniel Hochman
committed
Oct 14, 2020
1 parent
1aab03c
commit f75cafd
Showing
3 changed files
with
43 additions
and
1 deletion.
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
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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor" | ||
) | ||
|
||
func TestParseFlagsEmptyNoPanic(t *testing.T) { | ||
reg := descriptor.NewRegistry() | ||
parseFlags(reg, "") | ||
} | ||
|
||
func TestParseFlags(t *testing.T) { | ||
reg := descriptor.NewRegistry() | ||
parseFlags(reg, "allow_repeated_fields_in_body=true") | ||
if *allowRepeatedFieldsInBody != true { | ||
t.Errorf("flag allow_repeated_fields_in_body was not set correctly, wanted true got %v", *allowRepeatedFieldsInBody) | ||
} | ||
} | ||
|
||
func TestParseFlagsMultiple(t *testing.T) { | ||
reg := descriptor.NewRegistry() | ||
parseFlags(reg, "allow_repeated_fields_in_body=true,import_prefix=foo") | ||
if *allowRepeatedFieldsInBody != true { | ||
t.Errorf("flag allow_repeated_fields_in_body was not set correctly, wanted 'true' got '%v'", *allowRepeatedFieldsInBody) | ||
} | ||
if *importPrefix != "foo" { | ||
t.Errorf("flag importPrefix was not set correctly, wanted 'foo' got '%v'", *importPrefix) | ||
} | ||
} |