mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 14:18:42 +01:00
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:
13
test/core/class/equality.wren
Normal file
13
test/core/class/equality.wren
Normal 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
|
||||
9
test/core/class/name.wren
Normal file
9
test/core/class/name.wren
Normal 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
|
||||
15
test/core/class/supertype.wren
Normal file
15
test/core/class/supertype.wren
Normal 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
15
test/core/class/type.wren
Normal 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
|
||||
Reference in New Issue
Block a user