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)
| 18 | // Specification: "Formats a byte count as a human-readable string with |
| 19 | // appropriate unit suffix." |
| 20 | func 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. |
nothing calls this directly
no test coverage detected