Add new tests.
Fix old tests for new Struct datatype. svn: r10161
This commit is contained in:
parent
1da9a0c4b8
commit
5a8bc6fabb
10
collects/tests/typed-scheme/succeed/int-def-colon.ss
Normal file
10
collects/tests/typed-scheme/succeed/int-def-colon.ss
Normal file
|
@ -0,0 +1,10 @@
|
|||
#lang typed-scheme
|
||||
|
||||
(define-type-alias Int Integer)
|
||||
|
||||
(: foo (Int -> Int))
|
||||
(define (foo)
|
||||
(: loop (Int -> Int))
|
||||
(define (loop x)
|
||||
(loop x))
|
||||
(loop 0))
|
18
collects/tests/typed-scheme/succeed/module-lang.ss
Normal file
18
collects/tests/typed-scheme/succeed/module-lang.ss
Normal file
|
@ -0,0 +1,18 @@
|
|||
#lang scheme/load
|
||||
|
||||
(module m typed-scheme
|
||||
(: f (All (a) (a -> a)))
|
||||
(define (f x) x)
|
||||
(provide f))
|
||||
|
||||
(module n typed-scheme
|
||||
(require 'm))
|
||||
|
||||
(require typed-scheme)
|
||||
|
||||
(require 'n)
|
||||
|
||||
(current-namespace (module->namespace ''n))
|
||||
|
||||
(f 1)
|
||||
|
16
collects/tests/typed-scheme/succeed/provide-struct.ss
Normal file
16
collects/tests/typed-scheme/succeed/provide-struct.ss
Normal file
|
@ -0,0 +1,16 @@
|
|||
#lang scheme/load
|
||||
|
||||
|
||||
(module m typed-scheme
|
||||
(define-typed-struct A ())
|
||||
(define-typed-struct (x A) ([y : Number] [z : Boolean]))
|
||||
(: foo (x -> Number))
|
||||
(define (foo z) 1)
|
||||
(provide (all-defined-out)))
|
||||
|
||||
(module n scheme
|
||||
(require (prefix-in m: 'm))
|
||||
(m:foo (m:make-x 1 #f))
|
||||
m:x?)
|
||||
|
||||
(require 'n)
|
3
collects/tests/typed-scheme/succeed/require-poly.ss
Normal file
3
collects/tests/typed-scheme/succeed/require-poly.ss
Normal file
|
@ -0,0 +1,3 @@
|
|||
#lang typed-scheme
|
||||
|
||||
(require "simple-poly.ss")
|
5
collects/tests/typed-scheme/succeed/simple-poly.ss
Normal file
5
collects/tests/typed-scheme/succeed/simple-poly.ss
Normal file
|
@ -0,0 +1,5 @@
|
|||
(module simple-poly typed-scheme
|
||||
(: f (All (a) (a -> a)))
|
||||
(define (f x) x)
|
||||
(define: z : Any 2)
|
||||
(provide f))
|
16
collects/tests/typed-scheme/succeed/struct-cert.ss
Normal file
16
collects/tests/typed-scheme/succeed/struct-cert.ss
Normal file
|
@ -0,0 +1,16 @@
|
|||
#lang scheme/load
|
||||
|
||||
(module for-broken typed-scheme
|
||||
|
||||
(define-typed-struct type ())
|
||||
|
||||
(provide (all-defined-out)))
|
||||
|
||||
(module broken typed-scheme
|
||||
|
||||
(require (prefix-in t: 'for-broken))
|
||||
(define-typed-struct binding ([type : t:type]))
|
||||
;; Comment out the below and it works fine.
|
||||
(provide (all-defined-out)))
|
||||
|
||||
(require 'broken)
|
|
@ -110,10 +110,10 @@
|
|||
(cl-> [() (-pair N (-v b))]
|
||||
[(N) (-pair N (-v b))])]
|
||||
|
||||
[(-poly (a) ((Un (-base 'foo) (-struct 'bar #f (list N a) #f)) . -> . (-lst a)))
|
||||
((Un (-base 'foo) (-struct 'bar #f (list N (-pair N (-v a))) #f)) . -> . (-lst (-pair N (-v a))))]
|
||||
[(-poly (a) ((-struct 'bar #f (list N a) #f) . -> . (-lst a)))
|
||||
((-struct 'bar #f (list N (-pair N (-v a))) #f) . -> . (-lst (-pair N (-v a))))]
|
||||
[(-poly (a) ((Un (-base 'foo) (-struct 'bar #f (list N a) #f #f #f values)) . -> . (-lst a)))
|
||||
((Un (-base 'foo) (-struct 'bar #f (list N (-pair N (-v a))) #f #f #f values)) . -> . (-lst (-pair N (-v a))))]
|
||||
[(-poly (a) ((-struct 'bar #f (list N a) #f #f #f values) . -> . (-lst a)))
|
||||
((-struct 'bar #f (list N (-pair N (-v a))) #f #f #f values) . -> . (-lst (-pair N (-v a))))]
|
||||
|
||||
[(-poly (a) (a . -> . (make-Listof a))) ((-v b) . -> . (make-Listof (-v b)))]
|
||||
[(-poly (a) (a . -> . (make-Listof a))) ((-pair N (-v b)) . -> . (make-Listof (-pair N (-v b))))]
|
||||
|
|
|
@ -33,9 +33,11 @@
|
|||
[(-poly (x) (-> (Un Sym N) x)) (-poly (xyz) (-> (Un N Sym) xyz))]
|
||||
[(-mu x (Un N Sym x)) (-mu y (Un N Sym y))]
|
||||
;; found bug
|
||||
[FAIL (Un (-mu heap-node (-struct 'heap-node #f (list (-base 'comparator) N (-v a) (Un heap-node (-base 'heap-empty))) #f))
|
||||
[FAIL (Un (-mu heap-node
|
||||
(-struct 'heap-node #f (list (-base 'comparator) N (-v a) (Un heap-node (-base 'heap-empty))) #f #f #f values))
|
||||
(-base 'heap-empty))
|
||||
(Un (-mu heap-node (-struct 'heap-node #f (list (-base 'comparator) N (-pair N N) (Un heap-node (-base 'heap-empty))) #f))
|
||||
(Un (-mu heap-node
|
||||
(-struct 'heap-node #f (list (-base 'comparator) N (-pair N N) (Un heap-node (-base 'heap-empty))) #f #f #f values))
|
||||
(-base 'heap-empty))]))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user