Libraries written in Kotlin are factored out into a separate project

This commit is contained in:
Andrey Breslav
2012-03-06 18:48:49 +04:00
parent 7c6f1657d2
commit 0a08ac5fe8
253 changed files with 252 additions and 2703 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")
}
}
}