boot.test 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #! /bin/sh
  2. # -*-scheme-*-
  3. if [ "$MES" != guile ]; then
  4. MES_BOOT=boot-02.scm exec ${MES-mes} < $0
  5. fi
  6. exec ${MES-mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests boot)' -s "$0" "$@"
  7. !#
  8. ;;; -*-scheme-*-
  9. ;;; GNU Mes --- Maxwell Equations of Software
  10. ;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  11. ;;;
  12. ;;; This file is part of GNU Mes.
  13. ;;;
  14. ;;; GNU Mes is free software; you can redistribute it and/or modify it
  15. ;;; under the terms of the GNU General Public License as published by
  16. ;;; the Free Software Foundation; either version 3 of the License, or (at
  17. ;;; your option) any later version.
  18. ;;;
  19. ;;; GNU Mes is distributed in the hope that it will be useful, but
  20. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  21. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. ;;; GNU General Public License for more details.
  23. ;;;
  24. ;;; You should have received a copy of the GNU General Public License
  25. ;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
  26. (define-module (tests boot)
  27. #:use-module (mes mes-0)
  28. #:use-module (mes test))
  29. (cond-expand
  30. (mes
  31. (primitive-load "module/mes/test.scm"))
  32. (guile-2)
  33. (guile
  34. (use-modules (ice-9 syncase))))
  35. (pass-if "first dummy" #t)
  36. (pass-if-not "second dummy" #f)
  37. (pass-if-eq "begin" 3 (begin 'a 'b (+ 1 2)))
  38. (define *top-define-a* '*top-define-a*)
  39. (begin (define *top-begin-define-a* '*top-begin-define-a*))
  40. (pass-if-eq "top define " '*top-define-a* *top-define-a*)
  41. (pass-if "eq?" (eq? 0 '0))
  42. (pass-if-eq "if" 'true (if #t 'true))
  43. (pass-if-eq "if 2" *unspecified* (if #f #f))
  44. (pass-if-eq "if 3" 'true (if #t 'true))
  45. (pass-if-eq "if 4" 'true (if (eq? 0 '0) 'true))
  46. (pass-if-eq "if 5" 'false (if (= 1 2) 'true 'false))
  47. (pass-if-eq "append2 1" '0 (append2 '() 0))
  48. (pass-if-eq "append2 3" 0 (append 0))
  49. (pass-if-eq "append2 4" 'cons (append2 (cdr '(c)) (car '(cons))))
  50. (result 'report)