TestFromHeadersRejectsNaNAndInf: ParseFloat accepts NaN/±Inf without error and the [0,1] clamp is a no-op against NaN, so they'd render as int(NaN*100+0.5) → MinInt64. Both must collapse to the missing-header zero.
(t *testing.T)
| 86 | // error and the [0,1] clamp is a no-op against NaN, so they'd render as |
| 87 | // int(NaN*100+0.5) → MinInt64. Both must collapse to the missing-header zero. |
| 88 | func TestFromHeadersRejectsNaNAndInf(t *testing.T) { |
| 89 | cases := []string{"NaN", "+Inf", "-Inf", "Infinity"} |
| 90 | for _, raw := range cases { |
| 91 | t.Run(raw, func(t *testing.T) { |
| 92 | h := http.Header{} |
| 93 | h.Set("X-Budget-Remaining", raw) |
| 94 | got := FromHeaders(h) |
| 95 | if got.Set { |
| 96 | t.Fatalf("X-Budget-Remaining=%q must be treated as missing, got %+v", raw, got) |
| 97 | } |
| 98 | }) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | func TestStatusSuffix(t *testing.T) { |
| 103 | if got := (BudgetStatus{}).StatusSuffix(); got != "" { |
nothing calls this directly
no test coverage detected