Changeset 37616 in project
- Timestamp:
- 05/25/19 10:28:50 (7 months ago)
- Location:
- release/5/matchable/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
release/5/matchable/trunk/matchable.scm
r37615 r37616 30 30 (define-syntax is-a? 31 31 (syntax-rules () 32 ((_ obj type) (record-instance? obj (quote type)))))32 ((_ obj type) (record-instance? obj type)))) 33 33 34 34 (include "match.scm") -
release/5/matchable/trunk/tests/run.scm
r35591 r37616 1 1 #;(include "../matchable.scm") 2 2 3 (import scheme (chicken base) (chicken memory representation) 4 matchable test) 3 (import scheme (chicken base) matchable test) 5 4 6 5 (test-begin "match") … … 103 102 x))) 104 103 105 #+(not alexpander)106 104 (test-group "records" 105 (module boxes (box make-box) 106 (import scheme (chicken base)) 107 (define-record box value)) 108 109 (import boxes) 110 107 111 (define-record point x y) 108 112 (define-record-type my-box (make-my-box x) box? (x get-my-box-x)) 109 113 110 (test "record" 114 (test "toplevel record using raw name" 115 '(123 456) 116 (match (make-point 123 456) (($ 'point x y) (list x y)))) 117 118 (test "toplevel record using identifier" 111 119 '(123 456) 112 120 (match (make-point 123 456) (($ point x y) (list x y)))) 113 121 122 (test-error "module-namespaced record using invalid raw name fails" 123 (match (make-box 123) (($ 'foo#box x) (list x)))) 124 125 (test "module-namespaced record using raw name" 126 '(123) 127 (match (make-box 123) (($ 'boxes#box x) (list x)))) 128 129 (test "module-namespaced record using identifier" 130 '(456) 131 (match (make-box 456) (($ box x) (list x)))) 132 114 133 (test "record with different predicate name" 115 134 'ok … … 123 142 124 143 (test-error "record with @ pattern should fail" 125 (match (make-point 123 456) ((@ point (x a) (y b)) 'ok)))144 (match (make-point 123 456) ((@ point (x a) (y b)) 'ok))) 126 145 127 146
Note: See TracChangeset
for help on using the changeset viewer.