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 ;
6 { "A B" } [ "A" "B" "${1} ${0}" interpolate>string ] unit-test
7 { "B A" } [ "A" "B" "${0} ${1}" interpolate>string ] unit-test
8 { "C A" } [ "A" "B" "C" "${0} ${2}" interpolate>string ] unit-test
9 { "C B A" } [ "A" "B" "C" "${} ${1} ${2}" interpolate>string ] unit-test
13 "Hello, ${name}." interpolate>string
18 "Mr." "${0} ${name}" interpolate>string
21 { "Hello, Mr. Anderson" } [
23 "Hello, ${} ${}" interpolate>string
26 { "Mixing named and stack variables... stacks are cool!" } [
29 "Mixing ${} and ${} variables... ${0}s are ${what}"
33 { "Sup Dawg, we heard you liked rims, so we put rims on your rims so you can roll while you roll." } [
37 "Sup ${name}, we heard you liked ${noun}, so we put ${noun} on your ${noun} so you can ${verb} while you ${verb}." interpolate>string
40 { "Oops, I accidentally the whole economy..." } [
43 "accidentally" [ I[ Oops, I ${0} the whole ${noun}...]I ] with-string-writer