Skip to content

[spec-enforcer] Enforce specifications for cli, console, constants#39550

Merged
pelikhan merged 1 commit into
mainfrom
spec-enforce-console-format-tokens-721dd3860922e0da
Jun 16, 2026
Merged

[spec-enforcer] Enforce specifications for cli, console, constants#39550
pelikhan merged 1 commit into
mainfrom
spec-enforce-console-format-tokens-721dd3860922e0da

Conversation

@github-actions

@github-actions github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a missing spec test for FormatTokens in pkg/console, closing a gap between the function's documented behavior and its test coverage. The test is derived directly from the examples in pkg/console/README.md.

Changes

pkg/console/spec_test.go — new test: TestSpec_PublicAPI_FormatTokens

Adds a table-driven spec test covering all four documented output cases:

Input Expected output Case
0 "-" Zero renders as dash (no-data sentinel)
500 "500" Sub-1000 renders as plain integer
1500 "1.5K" Thousands render with K suffix
1_200_000 "1.2M" Millions render with M suffix

The test follows the existing TestSpec_PublicAPI_FormatNumber pattern immediately above it and carries a spec-comment block quoting the governing specification sentence from the README.

Type of change

  • Test / spec coverage (no production code changed)

Impact

  • Breaking change: No
  • Production code modified: No — test file only (+28 lines, pkg/console/spec_test.go)
  • Spec gap closed: FormatTokens was documented in pkg/console/README.md but had no corresponding TestSpec_PublicAPI_* entry in spec_test.go

Commit

376ac39dd Enforce specification for console: add FormatTokens spec test

Generated by PR Description Updater for issue #39550 · 99.1 AIC · ⌖ 12.6 AIC · ⊞ 20.9K ·

Add TestSpec_PublicAPI_FormatTokens to pkg/console/spec_test.go, derived
from the documented behavior in pkg/console/README.md. The README documents
exact outputs for FormatTokens (0 -> "-", 500 -> "500", 1500 -> "1.5K",
1200000 -> "1.2M") but no spec test covered the function.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant