Drop deprecated StringTemplate from StdLib and move it to kotlin-jdbc, which is using it.
This commit is contained in:
-3
@@ -2,14 +2,11 @@ package kotlin.template
|
||||
|
||||
import kotlin.dom. *
|
||||
import org.w3c.dom.Node
|
||||
import com.sun.org.apache.xalan.internal.xsltc.dom.UnionIterator
|
||||
import java.util.Locale
|
||||
import java.text.NumberFormat
|
||||
import java.text.DateFormat
|
||||
import java.util.Date
|
||||
|
||||
// TODO this class should move into the runtime
|
||||
// in kotlin.StringTemplate
|
||||
deprecated("This class is part of an experimental implementation of string templates and is going to be removed")
|
||||
public class StringTemplate(private val values: Array<Any?>) {
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package test.template
|
||||
|
||||
import kotlin.template.*
|
||||
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()
|
||||
|
||||
// TODO will use a tuple soon
|
||||
//val actual = StringTemplate(Tuple3<String,String,String>("<h1>", foo, "</h1> <p>hey ", bar, "</p>")).toHtml()
|
||||
val actual = StringTemplate(arrayOf("<h1>", foo, "</h1> <p>hey ", bar, "</p>")).toHtml()
|
||||
|
||||
assertEquals("<h1>James</h1> <p>hey x > 1</p>", actual)
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
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<String,String>("hello ", name))
|
||||
val actual = StringTemplate(arrayOf("hello ", name,
|
||||
" price ", price,
|
||||
" data ", now)).toString(formatter)
|
||||
|
||||
println("Got text: $actual")
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package test.template
|
||||
|
||||
import kotlin.template.*
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
import junit.framework.TestCase
|
||||
|
||||
class StringTemplateTest : TestCase() {
|
||||
fun testTemplate(): Unit {
|
||||
val name = "James"
|
||||
|
||||
// Code generated by the following template expression:
|
||||
//
|
||||
// val actual = "hello $name!".toString()
|
||||
|
||||
// TODO will use a tuple soon
|
||||
//val actual = StringTemplate(Tuple3<String,String,String>("hello ", name, "!"))).toString()
|
||||
val actual = StringTemplate(arrayOf("hello ", name, "!")).toString()
|
||||
|
||||
assertEquals("hello James!", actual)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user