MCPcopy Create free account
hub / github.com/cli/cli / TestIsBinaryContents

Function TestIsBinaryContents

pkg/cmd/gist/shared/shared_test.go:61–94  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

59}
60
61func TestIsBinaryContents(t *testing.T) {
62 tests := []struct {
63 fileContent []byte
64 want bool
65 }{
66 {
67 want: false,
68 fileContent: []byte("package main"),
69 },
70 {
71 want: false,
72 fileContent: []byte(""),
73 },
74 {
75 want: false,
76 fileContent: []byte(nil),
77 },
78 {
79 want: true,
80 fileContent: []byte{239, 191, 189, 239, 191, 189, 239, 191, 189, 239,
81 191, 189, 239, 191, 189, 16, 74, 70, 73, 70, 239, 191, 189, 1, 1, 1,
82 1, 44, 1, 44, 239, 191, 189, 239, 191, 189, 239, 191, 189, 239, 191,
83 189, 239, 191, 189, 67, 239, 191, 189, 8, 6, 6, 7, 6, 5, 8, 7, 7, 7,
84 9, 9, 8, 10, 12, 20, 10, 12, 11, 11, 12, 25, 18, 19, 15, 20, 29, 26,
85 31, 30, 29, 26, 28, 28, 32, 36, 46, 39, 32, 34, 44, 35, 28, 28, 40,
86 55, 41, 44, 48, 49, 52, 52, 52, 31, 39, 57, 61, 56, 50, 60, 46, 51,
87 52, 50, 239, 191, 189, 239, 191, 189, 239, 191, 189, 67, 1, 9, 9, 9, 12},
88 },
89 }
90
91 for _, tt := range tests {
92 assert.Equal(t, tt.want, IsBinaryContents(tt.fileContent))
93 }
94}
95
96func TestPromptGists(t *testing.T) {
97 sixHours, _ := time.ParseDuration("6h")

Callers

nothing calls this directly

Calls 2

IsBinaryContentsFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected