Clean up constructor tests.

This commit is contained in:
Bob Nystrom
2013-11-29 15:21:36 -08:00
parent 325bb281a5
commit b390bdf604
2 changed files with 18 additions and 0 deletions
-20
View File
@@ -1,20 +0,0 @@
class Foo {
this bar { io.write("this bar") }
this baz { io.write("this baz") }
this bar(arg) { io.write("this bar " + arg) }
toString { "Foo" }
}
// Different names.
Foo.bar // expect: this bar
Foo.baz // expect: this baz
// Can overload by arity.
Foo.bar // expect: this bar
Foo.bar("one") // expect: this bar one
// Returns the new instance.
var foo = Foo.bar // expect: this bar
io.write(foo is Foo) // expect: true
io.write(foo.toString) // expect: Foo