moved the stdlib tests into the same directory as the stdlib, so it works a bit better with maven support in IDEA

This commit is contained in:
James Strachan
2012-03-14 16:14:04 +00:00
parent 9cd21d3a4d
commit 7ef65c0099
35 changed files with 2 additions and 2 deletions
@@ -0,0 +1,23 @@
package test.language
import junit.framework.TestCase
import kotlin.test.*
import org.jetbrains.kotlin.support.*
fun localUseWorks(): Unit {
val c = javaClass<Runnable>()
println("class is $c")
}
class JavaClassTest : TestCase() {
fun testJavaClass() {
localUseWorks()
// TODO this function fails!
// see KT-1515
loadAsserter()
}
}
@@ -0,0 +1,20 @@
package test.language
import junit.framework.TestCase
import java.util.Collection
import kotlin.test.*
class NullableCollectionsTest : TestCase() {
fun testIterateOverNullCollectionsThrowsNPE() {
val c: Collection<String>? = null
// TODO currently this will throw a NPE
// should it either be a compile error or handle nulls gracefully?
failsWith<NullPointerException> {
for (e in c) {
println("Hey got $e")
}
}
}
}
@@ -0,0 +1,38 @@
package language
import kotlin.util.*
import java.util.*
import junit.framework.TestCase
class Product(val name: String, val price: Double) {
}
class Customer(val name: String, val products: List<Product>) {
}
fun customerTemplate(customer: Customer) = """
<html>
<body>
<h1>Hello ${customer.name}</h1>
<ul>
${customer.products.map<Product,String>{ productSnippet(it) }.join("\n")}
</ul>
<p>lets do some kool stuff</p>
</body>
"""
fun productSnippet(product: Product) = "<li>${product.name}. Price : ${product.price}</li>"
// TODO support number formatting methods?
// fun productSnippet(product: Product) = "<li>${product.name}. Price : ${product.price.format('## ###,00')} </li>"
class StringExpressionExampleTest : TestCase() {
val customer = Customer("James", arrayList(Product("Beer", 1.99), Product("Wine", 5.99)))
fun testExpressions(): Unit {
println(customerTemplate(customer))
}
}
@@ -0,0 +1,5 @@
package language.main
fun main(args: Array<String>) {
println("Hello world!")
}