(t *testing.T)
| 176 | } |
| 177 | |
| 178 | func TestConcurrentQuery(t *testing.T) { |
| 179 | var wg sync.WaitGroup |
| 180 | for i := 0; i < 10; i++ { |
| 181 | wg.Add(1) |
| 182 | go func(i int) { |
| 183 | defer wg.Done() |
| 184 | s := `<html><head></head><body><div>a</div></body>` |
| 185 | doc := loadHTML(s) |
| 186 | if n := FindOne(doc, `//div`); n == nil { |
| 187 | t.Fatalf("should find one but got nil [%d]", i) |
| 188 | } |
| 189 | }(i) |
| 190 | } |
| 191 | wg.Wait() |
| 192 | } |
| 193 | |
| 194 | func TestLoadURL_ErrorCases(t *testing.T) { |
| 195 | tests := []struct { |