MCPcopy Index your code
hub / github.com/cli/cli / TestIsBinaryContents

Function TestIsBinaryContents

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

IsBinaryContentsFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected