MCPcopy Create free account
hub / github.com/docker/docker-agent / TestIsTextFile_KnownBinaryExtensions

Function TestIsTextFile_KnownBinaryExtensions

pkg/chat/chat_test.go:102–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

100}
101
102func 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
119func TestIsTextFile_ByteSniffing(t *testing.T) {
120 t.Parallel()

Callers

nothing calls this directly

Calls 2

IsTextFileFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected