and-let-star.test 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. ;;;; and-let-star.test --- Tests for Guile and-let-star module. -*- scheme -*-
  2. ;;;;
  3. ;;;; Copyright (C) 2004, 2006 Free Software Foundation, Inc.
  4. ;;;;
  5. ;;;; This program is free software; you can redistribute it and/or modify
  6. ;;;; it under the terms of the GNU General Public License as published by
  7. ;;;; the Free Software Foundation; either version 2, or (at your option)
  8. ;;;; any later version.
  9. ;;;;
  10. ;;;; This program is distributed in the hope that it will be useful,
  11. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ;;;; GNU General Public License for more details.
  14. ;;;;
  15. ;;;; You should have received a copy of the GNU General Public License
  16. ;;;; along with this software; see the file COPYING. If not, write to
  17. ;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18. ;;;; Boston, MA 02110-1301 USA
  19. (define-module (test-suite test-and-let-star)
  20. #:use-module (test-suite lib)
  21. #:use-module (ice-9 and-let-star))
  22. ;;;
  23. ;;; and-let*
  24. ;;;
  25. (with-test-prefix "and-let*"
  26. (pass-if "cond-expand srfi-2"
  27. (cond-expand (srfi-2 #t)
  28. (else #f)))
  29. (with-test-prefix "no bindings"
  30. (pass-if "no result expression (gives #t)"
  31. (and-let* ()))
  32. (pass-if "result expression"
  33. (and-let* ()
  34. #t))
  35. (pass-if "two result expressions"
  36. (and-let* ()
  37. #f
  38. #t)))
  39. (with-test-prefix "one binding"
  40. (pass-if "no result expression (gives #t)"
  41. (and-let* ((x 123))))
  42. (pass-if "result expression"
  43. (and-let* ((x 123))
  44. #t))
  45. (pass-if "result variable"
  46. (and-let* ((x #t))
  47. x))
  48. (pass-if "two result expressions"
  49. (and-let* ((x 123))
  50. #f
  51. #t)))
  52. (with-test-prefix "one test"
  53. (pass-if "no result expression (gives #t)"
  54. (and-let* (( 123))))
  55. (pass-if "result expression"
  56. (and-let* (( 123))
  57. #t))
  58. (pass-if "two result expressions"
  59. (and-let* (( 123))
  60. #f
  61. #t))))