mirror of
https://github.com/zekexiao/pocketlang.git
synced 2025-02-06 04:37:47 +08:00
![Thakee Nathees](/assets/img/avatar_default.png)
at this point only binary operators are implemented, unary are yet to do. getters and setters for native classes implemented with the names @getter, and @setter (however the names or arity aren't validated at the moment TODO:)
24 lines
584 B
Plaintext
24 lines
584 B
Plaintext
|
|
## TODO: this dummy module is just to test different aspects of the
|
|
## native module interface and will be removed once it become stable
|
|
## and we have enough tests on other native interfaces.
|
|
|
|
from dummy import Dummy
|
|
|
|
d = Dummy()
|
|
print(d)
|
|
|
|
assert(d.val == 0) ## @getter
|
|
d.val = 3.14 ## @setter
|
|
assert(d.val == 3.14)
|
|
|
|
assert(d == 3.14) ## == overload
|
|
assert(d > 3) ## > overload
|
|
assert(d >= 3) ## > overload
|
|
assert(d >= 3.14) ## > and == overload
|
|
|
|
assert(d.a_method(12, 34) == 408) ## method
|
|
|
|
# If we got here, that means all test were passed.
|
|
print('All TESTS PASSED')
|