guile-rsv

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

arbitrary-null-tests.scm (1003B)


      1 (define-library (rsv arbitrary-null-tests)
      2   (import (scheme base)
      3           (srfi srfi-64)
      4           (rsv arbitrary-null))
      5 
      6   (begin
      7     (define (test null-value scm)
      8       (let ((output-bytevector-port (open-output-bytevector)))
      9         (scm->rsv scm
     10                   (lambda (x)
     11                     (equal? null-value
     12                             x))
     13                   output-bytevector-port)
     14         (let ((bytevector (get-output-bytevector output-bytevector-port)))
     15           (let ((new-scm (rsv->scm null-value
     16                                    (open-input-bytevector bytevector))))
     17             (test-equal
     18                 scm
     19               new-scm)))))
     20 
     21     (test-begin "rsv-arbitrary-null-tests")
     22     (test #f '())
     23     (test #f '((#f)))
     24     (test #f '(("")))
     25     (test #f '(("a")))
     26     (test #f '(("a" "")))
     27     (test #f '(("" "a")))
     28     (test #t '(("bc" "a") ("def" #t "efsdf") () ("def")))
     29     (test 10 '(("bc" "a") ("def" 10 "efsdf") () ("def")))
     30     (test-end "rsv-arbitrary-null-tests")))