aboutsummaryrefslogtreecommitdiffstats
path: root/lib/csc/format-test.csc
blob: 1906af65960a42c923c12f23494594d4d46b96c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(define-library (csc format-test)
  (import (scheme base)
          (only (csc strings) str-quote)
          (only (csc testing) assert-equal test)
          (csc format))
  (begin


    (test sprintf-single-string
      (assert-equal "test-string" (sprintf "test-string")))


    (test sprintf-list
      (assert-equal "(1 2 3)" (sprintf "{}" '(1 2 3))))


    (test sprintf-complex
      (assert-equal "this (1 2 3) is 1 a bbb test" (sprintf "this {} is {} a {} test" '(1 2 3) 1 "bbb")))


    (test sprintf-escape-open
      (assert-equal "{" (sprintf "{{")))


    (test sprintf-escape-close
      (assert-equal "}" (sprintf "}}")))))