nomsu/tests/object.nom
Bruce Hill 505fec2a61 Restructured the nomsu files to group all the essentials into core/ and
all the optionals into lib/. lib/core.nom and tests/all.nom are no
longer needed now.
2018-02-02 15:49:42 -08:00

24 lines
552 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."