(t *testing.T)
| 100 | } |
| 101 | |
| 102 | func TestIsTextFile_KnownBinaryExtensions(t *testing.T) { |
| 103 | t.Parallel() |
| 104 | // Binary extensions are not in the text allowlist and won't match byte-sniffing |
| 105 | // if the file doesn't exist (IsTextFile returns false for unreadable files) |
| 106 | binaryFiles := []string{ |
| 107 | "archive.tar.gz", "program.exe", "movie.mp4", "image.png", |
| 108 | } |
| 109 | |
| 110 | for _, f := range binaryFiles { |
| 111 | t.Run(f, func(t *testing.T) { |
| 112 | t.Parallel() |
| 113 | // These files don't exist, so byte-sniffing can't run either |
| 114 | assert.False(t, IsTextFile(f), "expected %s to not be detected as text", f) |
| 115 | }) |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | func TestIsTextFile_ByteSniffing(t *testing.T) { |
| 120 | t.Parallel() |
nothing calls this directly
no test coverage detected