forked from TrueCloudLab/frostfs-api-go
[#310] *: Implement string converters for enumerations
Implement `String` / `FromString` method pair in all levels of enum definitions. From now `String()` returns canonical protojson-compatible values. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
fdea892db7
commit
616b4b71a1
25 changed files with 1053 additions and 76 deletions
|
@ -192,3 +192,16 @@ func TestSearchFiltersEncoding(t *testing.T) {
|
|||
require.Equal(t, fs, fs2)
|
||||
})
|
||||
}
|
||||
|
||||
func TestSearchMatchType_String(t *testing.T) {
|
||||
toPtr := func(v object.SearchMatchType) *object.SearchMatchType {
|
||||
return &v
|
||||
}
|
||||
|
||||
testEnumStrings(t, new(object.SearchMatchType), []enumStringItem{
|
||||
{val: toPtr(object.MatchStringEqual), str: "STRING_EQUAL"},
|
||||
{val: toPtr(object.MatchStringNotEqual), str: "STRING_NOT_EQUAL"},
|
||||
{val: toPtr(object.MatchNotPresent), str: "NOT_PRESENT"},
|
||||
{val: toPtr(object.MatchUnknown), str: "MATCH_TYPE_UNSPECIFIED"},
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue