added test case for KT-2355
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2012 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.k2js.test.semantics;
|
||||||
|
|
||||||
|
public final class StringTemplatesTest extends AbstractExpressionTest {
|
||||||
|
|
||||||
|
public StringTemplatesTest() {
|
||||||
|
super("stringTemplates/");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TODO_testObjectWithExtensionToString() throws Exception {
|
||||||
|
fooBoxIsValue("a = abcX, b = defX");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testObjectWithToString() throws Exception {
|
||||||
|
fooBoxIsValue("a = abcS, b = defS");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testStringValues() throws Exception {
|
||||||
|
fooBoxTest();
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
class Foo(val name: String) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public fun Foo.toString(): String {
|
||||||
|
return name + "X"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val a = Foo("abc")
|
||||||
|
val b = Foo("def")
|
||||||
|
val message = "a = $a, b = $b"
|
||||||
|
return message
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
class Foo(val name: String) {
|
||||||
|
public fun toString(): String {
|
||||||
|
return name + "S"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val a = Foo("abc")
|
||||||
|
val b = Foo("def")
|
||||||
|
val message = "a = $a, b = $b"
|
||||||
|
return message
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
fun box(): Boolean {
|
||||||
|
val a = "abc"
|
||||||
|
val b = "def"
|
||||||
|
val message = "a = $a, b = $b"
|
||||||
|
|
||||||
|
if (message != "a = abc, b = def") return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user