From 0b55cf3df2876bc182fcb0216cc20f1564883d56 Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Thu, 4 Apr 2013 13:45:39 -0400 Subject: [PATCH] Refine contract check --- collects/net/private/ip.rkt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/collects/net/private/ip.rkt b/collects/net/private/ip.rkt index 8238a40ef3..2ed87794a2 100644 --- a/collects/net/private/ip.rkt +++ b/collects/net/private/ip.rkt @@ -329,5 +329,9 @@ (define (bytes-of-length n) (flat-named-contract `(bytes-of-length ,n) - (λ (bs) (= (bytes-length bs) n)))) + (λ (bs) (and (bytes? bs) (= (bytes-length bs) n))))) + +(module+ test + (check-true ((bytes-of-length 5) (bytes 1 2 3 4 5))) + (check-false ((bytes-of-length 5) "moogle")))