nomsu/tests/object.nom
2018-04-25 16:31:09 -07:00

25 lines
623 B
Plaintext

use "core"
use "lib/object2.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)
say "Object test passed."