MCPcopy
hub / github.com/bitfield/script / TestFirstDropsAllButFirstNLinesOfInput

Function TestFirstDropsAllButFirstNLinesOfInput

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

Source from the content-addressed store, hash-verified

525}
526
527func TestFirstDropsAllButFirstNLinesOfInput(t *testing.T) {
528 t.Parallel()
529 input := "a\nb\nc\n"
530 want := "a\nb\n"
531 got, err := script.Echo(input).First(2).String()
532 if err != nil {
533 t.Fatal(err)
534 }
535 if want != got {
536 t.Error(cmp.Diff(want, got))
537 }
538}
539
540func TestFirstHasNoOutputWhenNIs0(t *testing.T) {
541 t.Parallel()

Callers

nothing calls this directly

Calls 4

EchoFunction · 0.92
StringMethod · 0.80
FirstMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…