28 lines
597 B
Plaintext
28 lines
597 B
Plaintext
use "core"
|
|
use "lib/object.nom"
|
|
|
|
immediately
|
|
object "Dog"
|
|
action [bark]
|
|
%barks <- ("Bark!" for % in 1 to ((me).barks))
|
|
return: %barks joined with " "
|
|
|
|
action [get pissed off]
|
|
((me).barks) +<- 1
|
|
|
|
%d <-: new Dog {barks:2}
|
|
as %d
|
|
assume: (me) = %d
|
|
assume: ((me).barks) = 2
|
|
assume: (bark) = "Bark! Bark!"
|
|
get pissed off
|
|
assume: ((me).barks) = 3
|
|
assume: (bark) = "Bark! Bark! Bark!"
|
|
assume: "\(%d's "class")" = "Dog"
|
|
assume: (%d's "barks") = 3
|
|
|
|
as: new Dog {barks:1}
|
|
assume: (bark) = "Bark!"
|
|
|
|
say "Object test passed."
|