update check-duplicates with #:default kw arg

This commit is contained in:
Andrew Kent 2017-11-10 12:02:35 -05:00 committed by GitHub
parent 9fe2252eef
commit 4a869d97d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 3 deletions

View File

@ -3323,10 +3323,22 @@
(->key (-lst a) (-> b b -Boolean) #:key (-> a b) #f #:cache-keys? -Boolean #f (-lst a)))))
(check-duplicates
(-poly
(a b)
(a b c)
(cl->*
(->optkey (-lst a) ((-> a a Univ)) #:key (-> a a) #f (-opt a))
(->optkey (-lst a) ((-> b b Univ)) #:key (-> a b) #f (-opt a)))))
(->optkey (-lst a) ((-> a a Univ))
#:key (-> a a) #f
(-opt a))
(->optkey (-lst a) ((-> b b Univ))
#:key (-> a b) #f
(-opt a))
(->optkey (-lst a) ((-> a a Univ))
#:key (-> a a) #f
#:default (-> c) #f
(Un a c))
(->optkey (-lst a) ((-> b b Univ))
#:key (-> a b) #f
#:default (-> c) #f
(Un a c)))))
(remove-duplicates
(-poly
(a b)

View File

@ -1439,6 +1439,22 @@
[tc-e (remf symbol? '(a b c)) (-lst (one-of/c 'a 'b 'c))]
[tc-e (remf* symbol? '(a b c)) (-lst (one-of/c 'a 'b 'c))]
[tc-e (check-duplicates '("a" "a" "b")) (-opt -String)]
[tc-e (check-duplicates '("a" "a" "b") string=?) (-opt -String)]
;[tc-e ((inst check-duplicates String Number)
; '("a" "aa" "aaa")
; #:key string-length)
; (-opt -String)]
[tc-e ((inst check-duplicates String Any 'nope)
'("a" "a" "b")
string=?
#:default (λ () 'nope))
(Un (-val 'nope) -String)]
[tc-e ((inst check-duplicates String Number 'nope)
'("Hello" "world")
=
#:key string-length
#:default (λ () 'nope))
(Un -String (-val 'nope))]
;;Path tests
(tc-e (path-string? "foo") -Boolean)