| 123456789101112131415161718192021222324252627282930313233343536373839 |
- package tests
- import (
- "os"
- "path/filepath"
- "strings"
- "testing"
- "hth/internal/testutil"
- )
- func TestProtoEnumZeroUnspecified(t *testing.T) {
- root := testutil.HostRoot(t)
- proto := filepath.Join(root, "api", "proto", "hth", "api", "v1", "hth.proto")
- raw, err := os.ReadFile(proto)
- if err != nil {
- t.Fatal(err)
- }
- text := string(raw)
- if !strings.Contains(text, "package hth.api.v1;") {
- t.Fatal("package")
- }
- if !strings.Contains(text, "DEVICE_LIFECYCLE_STATE_UNSPECIFIED = 0") {
- t.Fatal("lifecycle 0")
- }
- if !strings.Contains(text, "DATA_QUALITY_UNSPECIFIED = 0") {
- t.Fatal("quality 0")
- }
- if !strings.Contains(text, "CONFIRMATION_STATUS_UNSPECIFIED = 0") {
- t.Fatal("confirmation 0")
- }
- if strings.Contains(text, "reserved ") {
- // reserved tags are optional in v1 as long as we never reuse; presence is fine
- }
- desc := filepath.Join(root, "api", "proto", "hth", "api", "v1", "hth.desc")
- if _, err := os.Stat(desc); err != nil {
- t.Fatalf("descriptor baseline missing: %v", err)
- }
- }
|