package template import kotlin.template.* import kotlin.test.assertEquals import junit.framework.TestCase import java.util.Date import java.util.Locale class LocaleTemplateTest : TestCase() { fun testDefaultLocale() : Unit { format(LocaleFormatter()) } fun testFrance() : Unit { format(LocaleFormatter(Locale.FRANCE)) } fun testGermany() : Unit { format(LocaleFormatter(Locale.GERMANY)) } fun format(formatter: LocaleFormatter): Unit { val name = "James" val price: Double = 1.99 val now = Date() // Code generated by the following template expression: // // val actual = format.toLocale("hello $name!") // TODO will use a tuple soon //val actual = formatter.format(StringTemplate(Tuple2("hello ", name)) val actual = StringTemplate(array("hello ", name, " price ", price, " data ", now)).toString(formatter) println("Got text: $actual") } }