20 lines
576 B
Kotlin
20 lines
576 B
Kotlin
package test.template.experiment
|
|
|
|
import kotlin.template.experiment2.*
|
|
import kotlin.test.assertEquals
|
|
|
|
import junit.framework.TestCase
|
|
|
|
class HtmlTemplateTest : TestCase() {
|
|
fun testTemplate(): Unit {
|
|
val foo = "James"
|
|
val bar = "x > 1"
|
|
|
|
// Code generated by the following template expression:
|
|
//
|
|
// val actual = "<h1>$foo</h1> <p>hey $bar</p>".toHtml()
|
|
val actual = StringTemplate(array("<h1>", "</h1> <p>hey ", "</p>"), array(foo, bar)).toHtml()
|
|
|
|
assertEquals("<h1>James</h1> <p>hey x > 1</p>", actual)
|
|
}
|
|
} |