Add tests/36_object_methods.claro from Claro v1.17.26 zip
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
CLASS Player
|
||||||
|
HAS name TEXT
|
||||||
|
HAS score NUMBER
|
||||||
|
|
||||||
|
TEACH show
|
||||||
|
SAY name
|
||||||
|
SAY score
|
||||||
|
END
|
||||||
|
|
||||||
|
TEACH add points
|
||||||
|
SET score score + points
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
NEW Player player
|
||||||
|
SET player.name "Jon"
|
||||||
|
SET player.score 10
|
||||||
|
DO player.show
|
||||||
|
DO player.add 5
|
||||||
|
SAY player.score
|
||||||
|
OBJECT CLASS player AS kind
|
||||||
|
SAY kind
|
||||||
|
OBJECT FIELDS player AS fields
|
||||||
|
COUNT fields AS total
|
||||||
|
SAY total
|
||||||
Reference in New Issue
Block a user