]> gitweb.factorcode.org Git - factor.git/blob - basis/interpolate/interpolate-tests.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / basis / interpolate / interpolate-tests.factor
1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: interpolate io.streams.string namespaces tools.test locals ;
4 IN: interpolate.tests
5
6 [ "Hello, Jane." ] [
7     "Jane" "name" set
8     [ "Hello, ${name}." interpolate ] with-string-writer
9 ] unit-test
10
11 [ "Sup Dawg, we heard you liked rims, so we put rims on your rims so you can roll while you roll." ] [
12     "Dawg" "name" set
13     "rims" "noun" set
14     "roll" "verb" set
15     [ "Sup ${name}, we heard you liked ${noun}, so we put ${noun} on your ${noun} so you can ${verb} while you ${verb}." interpolate ] with-string-writer
16 ] unit-test
17
18 [ "Oops, I accidentally the whole economy..." ] [
19     [let | noun [ "economy" ] |
20         [ I[ Oops, I accidentally the whole ${noun}...]I ] with-string-writer
21     ]
22 ] unit-test