Added test for OO.
This commit is contained in:
parent
a387fd86a8
commit
f1d4a568a3
22
tests/object.nom
Normal file
22
tests/object.nom
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
use "lib/core.nom"
|
||||||
|
use "lib/object.nom"
|
||||||
|
|
||||||
|
immediately:
|
||||||
|
define object "Dog":
|
||||||
|
action [bark]:
|
||||||
|
%barks <- ("Bark!" for all 1 to (@%barks))
|
||||||
|
return (%barks joined with " ")
|
||||||
|
action [get pissed off]:
|
||||||
|
(@%barks) +<- 1
|
||||||
|
|
||||||
|
%d <- (new Dog {barks:2})
|
||||||
|
as %d:
|
||||||
|
assume ((@) = %d)
|
||||||
|
assume ((@%barks) = 2)
|
||||||
|
assume ((bark) = "Bark! Bark!")
|
||||||
|
get pissed off
|
||||||
|
assume ((@%barks) = 3)
|
||||||
|
assume ((bark) = "Bark! Bark! Bark!")
|
||||||
|
assume ("\(%d's "class")" = "Dog")
|
||||||
|
assume ((%d's "barks") = 3)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user