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
|
@ -29,3 +29,15 @@ func TestClauseFromV2(t *testing.T) {
|
|||
require.Equal(t, item.cV2, item.c.ToV2())
|
||||
}
|
||||
}
|
||||
|
||||
func TestClause_String(t *testing.T) {
|
||||
toPtr := func(v Clause) *Clause {
|
||||
return &v
|
||||
}
|
||||
|
||||
testEnumStrings(t, new(Clause), []enumStringItem{
|
||||
{val: toPtr(ClauseDistinct), str: "DISTINCT"},
|
||||
{val: toPtr(ClauseSame), str: "SAME"},
|
||||
{val: toPtr(ClauseUnspecified), str: "CLAUSE_UNSPECIFIED"},
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue