Reorganize tests and benchmark scripts.

Mainly to get rid of one top level directory. But this will
also be useful when there are tests of the embedding API.
This commit is contained in:
Bob Nystrom
2015-03-14 12:45:56 -07:00
parent e2a72282a1
commit 64eccdd9be
562 changed files with 32 additions and 8 deletions

View File

@ -0,0 +1,13 @@
IO.print(Num == Num) // expect: true
IO.print(Num == Bool) // expect: false
// Not equal to other types.
IO.print(Num == 123) // expect: false
IO.print(Num == true) // expect: false
IO.print(Num != Num) // expect: false
IO.print(Num != Bool) // expect: true
// Not equal to other types.
IO.print(Num != 123) // expect: true
IO.print(Num != true) // expect: true

View File

@ -0,0 +1,9 @@
class Foo {}
IO.print(Foo.name) // expect: Foo
IO.print(Foo.type.name) // expect: Foo metaclass
// Make sure the built-in classes have proper names too.
IO.print(Object.name) // expect: Object
IO.print(Class.name) // expect: Class
IO.print(Bool.name) // expect: Bool

View File

@ -0,0 +1,15 @@
class Foo {}
class Bar is Foo {}
class Baz is Bar {}
// A class with no explicit superclass inherits Object.
IO.print(Foo.supertype == Object) // expect: true
// Otherwise, it's the superclass.
IO.print(Bar.supertype == Foo) // expect: true
IO.print(Baz.supertype == Bar) // expect: true
// Object has no supertype.
IO.print(Object.supertype) // expect: null

15
test/core/class/type.wren Normal file
View File

@ -0,0 +1,15 @@
class Foo {}
// A class is a class.
IO.print(Foo is Class) // expect: true
// It's metatype is also a class.
IO.print(Foo.type is Class) // expect: true
// The metatype's metatype is Class.
IO.print(Foo.type.type == Class) // expect: true
// And Class's metatype circles back onto itself.
IO.print(Foo.type.type.type == Class) // expect: true
IO.print(Foo.type.type.type.type == Class) // expect: true
IO.print(Foo.type.type.type.type.type == Class) // expect: true