(t *testing.T)
| 1133 | } |
| 1134 | |
| 1135 | func TestRejectRegexp_DropsMatchingLinesFromInput(t *testing.T) { |
| 1136 | t.Parallel() |
| 1137 | input := "hello world" |
| 1138 | tcs := []struct { |
| 1139 | regex, want string |
| 1140 | }{ |
| 1141 | { |
| 1142 | regex: `Hello|line`, |
| 1143 | want: "hello world\n", |
| 1144 | }, |
| 1145 | { |
| 1146 | regex: `hello|bogus`, |
| 1147 | want: "", |
| 1148 | }, |
| 1149 | { |
| 1150 | regex: `w.*d`, |
| 1151 | want: "", |
| 1152 | }, |
| 1153 | { |
| 1154 | regex: "wontmatch", |
| 1155 | want: "hello world\n", |
| 1156 | }, |
| 1157 | } |
| 1158 | for _, tc := range tcs { |
| 1159 | got, err := script.Echo(input).RejectRegexp(regexp.MustCompile(tc.regex)).String() |
| 1160 | if err != nil { |
| 1161 | t.Fatal(err) |
| 1162 | } |
| 1163 | if tc.want != got { |
| 1164 | t.Error(cmp.Diff(tc.want, got)) |
| 1165 | } |
| 1166 | } |
| 1167 | } |
| 1168 | |
| 1169 | func TestSHA256Sums_OutputsCorrectHashForEachSpecifiedFile(t *testing.T) { |
| 1170 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…