Tryng out some smalltalk + TDD + "good practices" I've run into a kinda ugly block:
How do I do an assertion in GNU Smalltalk?
I'm just looking for a simple ifFalse: [Die]
kind of thing
Tryng out some smalltalk + TDD + "good practices" I've run into a kinda ugly block:
How do I do an assertion in GNU Smalltalk?
I'm just looking for a simple ifFalse: [Die]
kind of thing
as well as self assert: [ ... some block ]
works for blocks & non-blocks, since sending #value to Object returns self.
It has been suggested above to add
#assert:
toObject
, but rather I'd add#assert
toBlockClosure
(or whatever[] class
is in GNU Smalltalk).and thus use as in
etcetera.
This is the code for assert: from Squeak (which I recommend you use rather than GNU):
It is simple. In your test methods you write:
But first you need to create a test class as a subclass of TestCase (in Squeak), for example:
Here you write testing methods, which names must always start with 'test', for instance :