(t *testing.T)
| 148 | } |
| 149 | |
| 150 | func TestMatch(t *testing.T) { |
| 151 | for _, tt := range matchTests { |
| 152 | re, err := Compile("(?m)" + tt.re) |
| 153 | if err != nil { |
| 154 | t.Errorf("Compile(%#q): %v", tt.re, err) |
| 155 | continue |
| 156 | } |
| 157 | b := []byte(tt.s) |
| 158 | lines := grep(re, b) |
| 159 | if !reflect.DeepEqual(lines, tt.m) { |
| 160 | t.Errorf("grep(%#q, %q) = %v, want %v", tt.re, tt.s, lines, tt.m) |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | func grep(re *Regexp, b []byte) []int { |
| 166 | var m []int |