| 1 | module scheme |
| 2 | |
| 3 | // Optional focused probes for syntax-only binder birth at capture boundaries. |
| 4 | fn review_enum_capture_text(wrapper string) string { |
| 5 | mut vm := new_with_options(Options{ max_steps: 1000000, max_frames: 24, max_expansions: 128 }) or { panic(err.msg()) } |
| 6 | output := if wrapper == 'let' { |
| 7 | "(list (syntax let) '() declaration use)" |
| 8 | } else { |
| 9 | '(list (syntax begin) declaration use)' |
| 10 | } |
| 11 | source := ' |
| 12 | (define-syntax make-enum |
| 13 | (lambda (stx) |
| 14 | (let ((a (syntax e)) (b (let ((e 99)) (syntax e)))) |
| 15 | (let ((declaration (list (syntax define-enumeration) (syntax t) |
| 16 | (list (syntax one) (syntax two)) a)) |
| 17 | (use (list (syntax enum-set->list) (list b (syntax one))))) |
| 18 | ' + output + ')))) |
| 19 | ((lambda () (make-enum)))' |
| 20 | return write(vm.eval(source) or { panic(err.msg()) }) or { panic(err.msg()) } |
| 21 | } |
| 22 | |
| 23 | fn test_optional_generated_enumeration_alias_captures_constructor_in_new_scope() { |
| 24 | assert review_enum_capture_text('let') == '(one)' |
| 25 | } |
| 26 | |
| 27 | fn test_optional_generated_enumeration_alias_captures_constructor_added_at_boundary_scope() { |
| 28 | assert review_enum_capture_text('begin') == '(one)' |
| 29 | } |
| 30 | |