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

Function TestRejectDropsMatchingLinesFromInput

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

Source from the content-addressed store, hash-verified

1076}
1077
1078func TestRejectDropsMatchingLinesFromInput(t *testing.T) {
1079 t.Parallel()
1080 input := "This is the first line in the file.\nHello, world.\nThis is another line in the file.\n"
1081 tcs := []struct {
1082 reject, want string
1083 }{
1084 {
1085 reject: "line",
1086 want: "Hello, world.\n",
1087 },
1088 {
1089 reject: "another",
1090 want: "This is the first line in the file.\nHello, world.\n",
1091 },
1092 {
1093 reject: "definitely won't match any lines",
1094 want: "This is the first line in the file.\nHello, world.\nThis is another line in the file.\n",
1095 },
1096 }
1097 for _, tc := range tcs {
1098 got, err := script.Echo(input).Reject(tc.reject).String()
1099 if err != nil {
1100 t.Fatal(err)
1101 }
1102 if tc.want != got {
1103 t.Error(cmp.Diff(tc.want, got))
1104 }
1105 }
1106}
1107
1108func TestPostPostsToGivenURLUsingPipeAsRequestBody(t *testing.T) {
1109 t.Parallel()

Callers

nothing calls this directly

Calls 4

EchoFunction · 0.92
StringMethod · 0.80
RejectMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…