summaryrefslogtreecommitdiff
path: root/src/pkg/path/path_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/path/path_test.go')
-rw-r--r--src/pkg/path/path_test.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/pkg/path/path_test.go b/src/pkg/path/path_test.go
index 6b4be07a9..ab0b48ad6 100644
--- a/src/pkg/path/path_test.go
+++ b/src/pkg/path/path_test.go
@@ -256,8 +256,11 @@ func TestWalk(t *testing.T) {
// 2) handle errors, expect none
errors := make(chan os.Error, 64)
Walk(tree.name, v, errors)
- if err, ok := <-errors; ok {
+ select {
+ case err := <-errors:
t.Errorf("no error expected, found: %s", err)
+ default:
+ // ok
}
checkMarks(t)
@@ -276,14 +279,21 @@ func TestWalk(t *testing.T) {
errors = make(chan os.Error, 64)
os.Chmod(Join(tree.name, tree.entries[1].name), 0)
Walk(tree.name, v, errors)
+ Loop:
for i := 1; i <= 2; i++ {
- if _, ok := <-errors; !ok {
+ select {
+ case <-errors:
+ // ok
+ default:
t.Errorf("%d. error expected, none found", i)
- break
+ break Loop
}
}
- if err, ok := <-errors; ok {
+ select {
+ case err := <-errors:
t.Errorf("only two errors expected, found 3rd: %v", err)
+ default:
+ // ok
}
// the inaccessible subtrees were marked manually
checkMarks(t)