MCPcopy
hub / github.com/harness/harness / Test_readTextFileFirstLineNotUTF8

Function Test_readTextFileFirstLineNotUTF8

git/parser/text_test.go:35–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func Test_readTextFileFirstLineNotUTF8(t *testing.T) {
36 scanner, _, err := ReadTextFile(bytes.NewReader([]byte{0xFF, 0xFF}), nil)
37
38 // method itself doesn't return an error, only the scanning fails for utf8.
39 assert.NotNil(t, scanner)
40 assert.NoError(t, err)
41
42 ok := scanner.Scan()
43 assert.False(t, ok)
44 assert.ErrorIs(t, scanner.Err(), ErrBinaryFile)
45}
46
47func Test_readTextFileNoLineEnding(t *testing.T) {
48 scanner, le, err := ReadTextFile(bytes.NewReader([]byte("abc")), nil)

Callers

nothing calls this directly

Calls 3

ReadTextFileFunction · 0.85
ScanMethod · 0.65
ErrMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…