aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/crypto/rand/rand_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/crypto/rand/rand_test.go')
-rw-r--r--src/pkg/crypto/rand/rand_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pkg/crypto/rand/rand_test.go b/src/pkg/crypto/rand/rand_test.go
index be3a5a221d..c5dbdb6cb8 100644
--- a/src/pkg/crypto/rand/rand_test.go
+++ b/src/pkg/crypto/rand/rand_test.go
@@ -29,3 +29,14 @@ func TestRead(t *testing.T) {
t.Fatalf("Compressed %d -> %d", len(b), z.Len())
}
}
+
+func TestReadEmpty(t *testing.T) {
+ n, err := Reader.Read(make([]byte, 0))
+ if n != 0 || err != nil {
+ t.Fatalf("Read(make([]byte, 0)) = %d, %v", n, err)
+ }
+ n, err = Reader.Read(nil)
+ if n != 0 || err != nil {
+ t.Fatalf("Read(make(nil) = %d, %v", n, err)
+ }
+}