| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package notify |
| 6 |
|
| 7 |
import ( |
| 8 |
"sort" |
| 9 |
"strings" |
| 10 |
"testing" |
| 11 |
) |
| 12 |
|
| 13 |
|
| 14 |
func s(s string) string { |
| 15 |
z := strings.Split(s, "|") |
| 16 |
sort.StringSlice(z).Sort() |
| 17 |
return strings.Join(z, "|") |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
func TestEventString(t *testing.T) { |
| 22 |
cases := map[Event]string{ |
| 23 |
Create: "notify.Create", |
| 24 |
Create | Remove: "notify.Create|notify.Remove", |
| 25 |
Create | Remove | Write: "notify.Create|notify.Remove|notify.Write", |
| 26 |
Create | Write | Rename: "notify.Create|notify.Rename|notify.Write", |
| 27 |
} |
| 28 |
for e, str := range cases { |
| 29 |
if s := s(e.String()); s != str { |
| 30 |
t.Errorf("want s=%s; got %s (e=%#x)", str, s, e) |
| 31 |
} |
| 32 |
} |
| 33 |
} |