moved old experimental code into the sandbox

This commit is contained in:
James Strachan
2012-03-21 08:56:43 +00:00
parent 669c7ec326
commit 81294d43ae
6 changed files with 0 additions and 0 deletions
@@ -0,0 +1,46 @@
package kotlin.template
import kotlin.*
import kotlin.template.io.*
import kotlin.io.*
import kotlin.util.*
import kotlin.test.*
import java.util.*
class EmailTemplate(var name: String = "James", var time: Date = Date()) : TextTemplate() {
override fun render() {
print("Hello there $name and how are you? Today is $time. Kotlin rocks")
}
}
class MoreDryTemplate(var name: String = "James", var time: Date = Date()) : TextTemplate() {
override fun render() {
+"Hey there $name and how are you? Today is $time. Kotlin rocks"
}
}
class TemplateCoreTest() : TestSupport() {
fun testDefaultValues() {
val text = EmailTemplate().renderToText()
assert {
println(text)
text.startsWith("Hello there James")
}
}
fun testDifferentValues() {
val text = EmailTemplate("Andrey").renderToText()
assert {
println(text)
text.startsWith("Hello there Andrey")
}
}
fun testMoreDryTemplate() {
val text = MoreDryTemplate("Alex").renderToText()
assert {
println(text)
text.startsWith("Hey there Alex")
}
}
}