Added a test for a trait extending two traits.
This commit is contained in:
@@ -39,4 +39,9 @@ public final class TraitTest extends AbstractClassTest {
|
||||
testFooBoxIsTrue("traitExtendsTrait.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void traitExtendsTwoTraits() throws Exception {
|
||||
testFooBoxIsTrue("traitExtendsTwoTraits.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace foo
|
||||
|
||||
trait A {
|
||||
fun addFoo(s:String) : String {
|
||||
return s + "FOO"
|
||||
}
|
||||
}
|
||||
|
||||
trait B {
|
||||
fun hooray() : String {
|
||||
return "hooray"
|
||||
}
|
||||
}
|
||||
|
||||
trait AD : A, B {
|
||||
|
||||
}
|
||||
|
||||
class Test() : AD {
|
||||
fun eval() : String {
|
||||
return addFoo(hooray());
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = (Test().eval() == "hoorayFOO")
|
||||
Reference in New Issue
Block a user