MCPcopy Index your code
hub / github.com/bitfield/script / TestEncodeBase64_CorrectlyEncodesInputBytes

Function TestEncodeBase64_CorrectlyEncodesInputBytes

script_test.go:2051–2064  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2049}
2050
2051func TestEncodeBase64_CorrectlyEncodesInputBytes(t *testing.T) {
2052 t.Parallel()
2053 input := []byte{8, 0, 0, 16}
2054 reader := bytes.NewReader(input)
2055 want := "CAAAEA=="
2056 got, err := script.NewPipe().WithReader(reader).EncodeBase64().String()
2057 if err != nil {
2058 t.Fatal(err)
2059 }
2060 if got != want {
2061 t.Logf("input %#v incorrectly encoded:", input)
2062 t.Error(cmp.Diff(want, got))
2063 }
2064}
2065
2066func TestWithStdErr_IsConcurrencySafeAfterExec(t *testing.T) {
2067 t.Parallel()

Callers

nothing calls this directly

Calls 5

NewPipeFunction · 0.92
StringMethod · 0.80
EncodeBase64Method · 0.80
WithReaderMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…