sdk: Fix fmt + add FieldType test (#19493)

* sdk: Fix fmt + add FieldType test

* Add test comment
This commit is contained in:
Tom Proctor
2023-03-10 18:07:48 +00:00
committed by GitHub
parent 5d20d598c3
commit ea33318b4b
3 changed files with 28 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package framework
import (
"context"
"fmt"
"net/http"
"reflect"
"strings"
@@ -811,3 +812,23 @@ func TestInitializeBackend(t *testing.T) {
t.Fatal("backend should be open")
}
}
// TestFieldTypeMethods tries to ensure our switch-case statements for the
// FieldType "enum" are complete.
func TestFieldTypeMethods(t *testing.T) {
unknownFormat := convertType(TypeInvalid).format
for i := TypeInvalid + 1; i < typeInvalidMax; i++ {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
if i.String() == TypeInvalid.String() {
t.Errorf("unknown type string for %d", i)
}
if convertType(i).format == unknownFormat {
t.Errorf("unknown schema for %d", i)
}
_ = i.Zero()
})
}
}