Add another unit test for operator overloading
This commit is contained in:
parent
9827345213
commit
c88578d537
8
unittests/operator_overload2.chai
Normal file
8
unittests/operator_overload2.chai
Normal file
@ -0,0 +1,8 @@
|
||||
def Bob::Bob() { }
|
||||
attr Bob::x
|
||||
def `-`(a, b) : is_type(a, "Bob") && is_type(b, "Bob") { a.x - b.x }
|
||||
var b = Bob()
|
||||
var c = Bob()
|
||||
b.x = 4
|
||||
c.x = 5
|
||||
print(b-c)
|
1
unittests/operator_overload2.txt
Normal file
1
unittests/operator_overload2.txt
Normal file
@ -0,0 +1 @@
|
||||
-1
|
Loading…
x
Reference in New Issue
Block a user