kzccm1d4if10m2xaz1wqy3xar821pp1r-my-site-anaphoric-git.test.suzanne.soy-0.0.1

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

amap-test.rkt (425B)


      1 #lang racket/base
      2 
      3 (require anaphoric/amap
      4          rackunit)
      5 
      6 (check-equal?
      7  '(2 3)
      8  (amap (add1 it) '(1 2))
      9  "Sanity check.")
     10 
     11 (check-equal?
     12  '("2" "4")
     13  (amap (number->string (+ it it)) '(1 2))
     14  "Multiple 'it' in a nested expression.")
     15 
     16 (define (f lst)
     17   (amap (/ it 0) lst))
     18 
     19 (check-equal?
     20  '()
     21  (f '())
     22  "Empty list.")
     23 
     24 (check-exn
     25    exn:fail?
     26    (lambda () (f '(1)))
     27    "To get 100% code coverage for the f function.")