PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/test-suite/schemerunme/global_vars_proxy.scm

#
Lisp | 31 lines | 24 code | 7 blank | 0 comment | 0 complexity | 45fc36a5b59ebf761bcfecd7e55382dc MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. (define-macro (check test)
  2. `(if (not ,test) (error "Error in test" ',test)))
  3. (b "hello")
  4. (check (string=? (b) "hello"))
  5. (define sa (make <A>))
  6. (slot-set! sa 'x 5)
  7. (a sa)
  8. (check (= (slot-ref (a) 'x) 5))
  9. (ap sa)
  10. (check (= (slot-ref (ap) 'x) 5))
  11. (slot-set! sa 'x 10)
  12. (check (= (slot-ref (ap) 'x) 10))
  13. (define sa2 (make <A>))
  14. (slot-set! sa2 'x -4)
  15. (cap sa2)
  16. (check (= (slot-ref (cap) 'x) -4))
  17. (slot-set! sa2 'x -7)
  18. (check (= (slot-ref (cap) 'x) -7))
  19. (check (= (slot-ref (ar) 'x) 5))
  20. (ar sa2)
  21. (check (= (slot-ref (ar) 'x) -7))
  22. (x 4)
  23. (check (= (x) 4))
  24. (exit 0)