aboutsummaryrefslogtreecommitdiffstats
path: root/csc/format-test.csc
blob: 6efaa876d29fc99d2f07aa14b135d19fac5a9e2d (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
(import (scheme base)
        (only (csc strings) str-quote)
        (only (csc testing) assert-equal test)
        (csc format))


(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 "}}")))