MCPcopy Create free account
hub / github.com/github/gh-aw / TestSpec_PublicAPI_FormatFileSize

Function TestSpec_PublicAPI_FormatFileSize

pkg/console/spec_test.go:20–50  ·  view source on GitHub ↗

TestSpec_PublicAPI_FormatFileSize validates the documented byte formatting behavior of FormatFileSize as described in the package README.md. Specification: "Formats a byte count as a human-readable string with appropriate unit suffix."

(t *testing.T)

Source from the content-addressed store, hash-verified

18// Specification: "Formats a byte count as a human-readable string with
19// appropriate unit suffix."
20func TestSpec_PublicAPI_FormatFileSize(t *testing.T) {
21 tests := []struct {
22 name string
23 size int64
24 expected string
25 }{
26 {
27 name: "zero bytes documented as '0 B'",
28 size: 0,
29 expected: "0 B",
30 },
31 {
32 name: "1500 bytes documented as '1.5 KB'",
33 size: 1500,
34 expected: "1.5 KB",
35 },
36 {
37 name: "2.1 million bytes documented as '2.0 MB'",
38 size: 2_100_000,
39 expected: "2.0 MB",
40 },
41 }
42
43 for _, tt := range tests {
44 t.Run(tt.name, func(t *testing.T) {
45 result := FormatFileSize(tt.size)
46 assert.Equal(t, tt.expected, result,
47 "FormatFileSize(%d) should match documented output", tt.size)
48 })
49 }
50}
51
52// TestSpec_Types_CompilerError validates that CompilerError has the documented
53// fields and structure as described in the package README.md.

Callers

nothing calls this directly

Calls 2

FormatFileSizeFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected