Changeset 11590 in project


Ignore:
Timestamp:
08/10/08 14:22:54 (12 years ago)
Author:
sjamaan
Message:

Add test and fix for breach of hygiene

Location:
release/4/defstruct/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/defstruct/trunk/defstruct.scm

    r11581 r11590  
    6767           (%not (rename 'not))
    6868           (%eq? (rename 'eq?))
    69            (%let (rename 'let)))
     69           (%let (rename 'let))
     70           (%uninitialized (rename 'uninitialized)))
    7071      (receive (init-fields no-init-fields)
    7172        (partition pair? fields)
     
    8990               obj)))
    9091          (,%define ,copy
    91             (,%let ((uninitialized (,%list)))
     92            (,%let ((,%uninitialized (,%list)))
    9293             (lambda (old ,%#!key ,@(map (lambda (f)
    93                                            (list f 'uninitialized))
     94                                           (list f %uninitialized))
    9495                                         field-names))
    9596               (let ((new (,make
    9697                           ,@(fold (lambda (f rest)
    9798                                    (cons (string->keyword (symbol->string f))
    98                                           (cons 'uninitialized rest)))
     99                                          (cons %uninitialized rest)))
    99100                                  '() field-names))))
    100101                ,@(map
    101102                   (lambda (f)
    102                      `(,%if (,%eq? ,f uninitialized)
     103                     `(,%if (,%eq? ,f ,%uninitialized)
    103104                            (,(string->symbol (conc type-name "-" f "-set!"))
    104105                             new
  • release/4/defstruct/trunk/tests/run.scm

    r11581 r11590  
    4545    (test #t (eq? (complex-field-4 c1)
    4646                  (complex-field-4 c3)))
    47     (test #f   (complex-field-3 c1))
     47    (test #f (complex-field-3 c1))
    4848    (set-complex! c1 field-1: 'mutated)
    4949    (test 'mutated (complex-field-1 c1))
    5050    (test 'bar (complex-field-1 c2))))
     51
     52(test-group "hygiene"
     53  (defstruct ini-capture (uninitialized 1))
     54  (define i1 (make-ini-capture))
     55  (test 1 (ini-capture-uninitialized (copy-ini-capture i1)))
     56  (test 2 (ini-capture-uninitialized (copy-ini-capture i1 uninitialized: 2))))
Note: See TracChangeset for help on using the changeset viewer.