Corrects types for typed/rackunit. Closes PR 11912.
Signed-off-by: Sam Tobin-Hochstadt <samth@racket-lang.org>
This commit is contained in:
parent
741361d413
commit
d0d748c55a
13
collects/tests/typed-scheme/succeed/pr11912.rkt
Normal file
13
collects/tests/typed-scheme/succeed/pr11912.rkt
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#lang typed/racket
|
||||||
|
|
||||||
|
(require typed/rackunit)
|
||||||
|
|
||||||
|
(check-exn (lambda (exn) #t)
|
||||||
|
(lambda () (/ 1 0)))
|
||||||
|
|
||||||
|
(check-equal? 2 2)
|
||||||
|
(check-not-exn (lambda () (begin0 3 4)))
|
||||||
|
|
||||||
|
(check-true #t)
|
||||||
|
(check-false #f)
|
||||||
|
(check-not-false 4)
|
|
@ -5,18 +5,14 @@
|
||||||
|
|
||||||
(define-type check-ish-ty
|
(define-type check-ish-ty
|
||||||
(case-lambda
|
(case-lambda
|
||||||
(Any Any -> (U #t Void))
|
(Any Any -> Void)
|
||||||
(Any Any String -> (U #t Void))))
|
(Any Any String -> Void)))
|
||||||
(define-type (Predicate A) (A -> Boolean))
|
(define-type (Predicate A) (A -> Boolean))
|
||||||
(define-type (Thunk A) (-> A))
|
(define-type (Thunk A) (-> A))
|
||||||
|
|
||||||
; 3.2
|
; 3.2
|
||||||
(require/typed/provide
|
(require/typed/provide
|
||||||
rackunit
|
rackunit
|
||||||
[check (All (A B C)
|
|
||||||
(case-lambda
|
|
||||||
((A B -> C) A B -> C)
|
|
||||||
((A B -> C) A B String -> C)))]
|
|
||||||
[check-eq? check-ish-ty]
|
[check-eq? check-ish-ty]
|
||||||
[check-not-eq? check-ish-ty]
|
[check-not-eq? check-ish-ty]
|
||||||
[check-eqv? check-ish-ty]
|
[check-eqv? check-ish-ty]
|
||||||
|
@ -24,40 +20,47 @@
|
||||||
[check-equal? check-ish-ty]
|
[check-equal? check-ish-ty]
|
||||||
[check-not-equal? check-ish-ty]
|
[check-not-equal? check-ish-ty]
|
||||||
[check-pred
|
[check-pred
|
||||||
(All (A B)
|
(All (A)
|
||||||
(case-lambda
|
(case-lambda
|
||||||
((A -> B) A -> #t)
|
((A -> Any) A -> Void)
|
||||||
((A -> B) A String -> #t)))]
|
((A -> Any) A String -> Void)))]
|
||||||
[check-=
|
[check-=
|
||||||
(case-lambda
|
(case-lambda
|
||||||
(Number Number Number -> #t)
|
(Real Real Real -> Void)
|
||||||
(Number Number Number String -> #t))]
|
(Real Real Real String -> Void))]
|
||||||
[check-true
|
[check-true
|
||||||
(case-lambda
|
(case-lambda
|
||||||
(Boolean -> #t)
|
(Any -> Void)
|
||||||
(Boolean String -> #t))]
|
(Any String -> Void))]
|
||||||
[check-false
|
[check-false
|
||||||
(case-lambda
|
(case-lambda
|
||||||
(Boolean -> #t)
|
(Any -> Void)
|
||||||
(Boolean String -> #t))]
|
(Any String -> Void))]
|
||||||
[check-not-false
|
[check-not-false
|
||||||
(case-lambda
|
(case-lambda
|
||||||
(Any -> #t)
|
(Any -> Void)
|
||||||
(Any String -> #t))]
|
(Any String -> Void))]
|
||||||
[check-exn
|
[check-exn
|
||||||
(case-lambda
|
(case-lambda
|
||||||
((Predicate Any) (Thunk Any) -> #t)
|
((U (Predicate Any) Regexp) (Thunk Any) -> Void)
|
||||||
((Predicate Any) (Thunk Any) String -> #t))]
|
((U (Predicate Any) Regexp) (Thunk Any) String -> Void))]
|
||||||
[check-not-exn
|
[check-not-exn
|
||||||
(case-lambda
|
(case-lambda
|
||||||
((Thunk Any) -> #t)
|
((Thunk Any) -> Void)
|
||||||
((Thunk Any) String -> #t))]
|
((Thunk Any) String -> Void))]
|
||||||
|
[check-regexp-match
|
||||||
|
(Regexp String -> Void)]
|
||||||
|
|
||||||
|
|
||||||
|
[check (All (A B)
|
||||||
|
(case-lambda
|
||||||
|
((A B -> Any) A B -> Void)
|
||||||
|
((A B -> Any) A B String -> Void)))]
|
||||||
|
|
||||||
[fail
|
[fail
|
||||||
(case-lambda
|
(case-lambda
|
||||||
(-> #t)
|
(-> Void)
|
||||||
(String -> #t))]
|
(String -> Void))])
|
||||||
[check-regexp-match
|
|
||||||
(Regexp String -> #t)])
|
|
||||||
|
|
||||||
; 3.2.1
|
; 3.2.1
|
||||||
(require-typed-struct check-info
|
(require-typed-struct check-info
|
||||||
|
@ -82,14 +85,6 @@
|
||||||
(require (only-in rackunit define-simple-check define-binary-check define-check fail-check))
|
(require (only-in rackunit define-simple-check define-binary-check define-check fail-check))
|
||||||
(provide define-simple-check define-binary-check define-check fail-check)
|
(provide define-simple-check define-binary-check define-check fail-check)
|
||||||
|
|
||||||
; 3.2.3
|
|
||||||
(require/typed/provide
|
|
||||||
rackunit
|
|
||||||
[current-check-handler
|
|
||||||
(Parameter (Any -> Any))]
|
|
||||||
[current-check-around
|
|
||||||
(Parameter ((Thunk Any) -> Any))])
|
|
||||||
|
|
||||||
; 3.3
|
; 3.3
|
||||||
(require (prefix-in t: (except-in rackunit struct:check-info struct:exn:test struct:exn:test:check struct:test-result struct:test-failure
|
(require (prefix-in t: (except-in rackunit struct:check-info struct:exn:test struct:exn:test:check struct:test-result struct:test-failure
|
||||||
struct:test-error struct:test-success)))
|
struct:test-error struct:test-success)))
|
||||||
|
@ -108,6 +103,8 @@
|
||||||
(require/opaque-type TestCase test-case? rackunit)
|
(require/opaque-type TestCase test-case? rackunit)
|
||||||
(provide TestCase test-case?)
|
(provide TestCase test-case?)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(require (only-in rackunit test-suite))
|
(require (only-in rackunit test-suite))
|
||||||
(provide test-suite)
|
(provide test-suite)
|
||||||
(require/opaque-type TestSuite test-suite? rackunit)
|
(require/opaque-type TestSuite test-suite? rackunit)
|
||||||
|
@ -168,3 +165,14 @@
|
||||||
; XXX Requires knowing more about test cases and structs
|
; XXX Requires knowing more about test cases and structs
|
||||||
#;[foldts-test-suite
|
#;[foldts-test-suite
|
||||||
XXX])
|
XXX])
|
||||||
|
|
||||||
|
|
||||||
|
; 5.1
|
||||||
|
(require/typed/provide
|
||||||
|
rackunit
|
||||||
|
[current-check-handler
|
||||||
|
(Parameter (Any -> Any))]
|
||||||
|
[current-check-around
|
||||||
|
(Parameter ((Thunk Any) -> Any))])
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user