| 1 | package glob |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | func TestEffectiveCriteria(t *testing.T) { |
| 9 | result, _ := EffectiveCriteria("xtest/*.txt", "xtest2/**/*.html", "xtest/*.js", "!xtest/*.html") |
| 10 | |
| 11 | if len(result.Roots()) != 2 { |
| 12 | t.Error("expected 2 items in result set") |
| 13 | } |
| 14 | |
| 15 | success := 0 |
| 16 | for _, c := range result.Items { |
| 17 | if strings.HasSuffix(c.Root, "/xtest") { |
| 18 | success++ |
| 19 | } |
| 20 | if strings.HasSuffix(c.Root, "/xtest2") { |
| 21 | success++ |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | if success != 2 { |
| 26 | t.Error("should calc effective criteria") |
| 27 | } |
| 28 | |
| 29 | } |