Happy !
tomooda / Assertalk
Monticello registration
About Assertalk
Assertalk enables Smalltalk programs to define invariant assertions to instance variables. For example, with the following class defintion,
Object subclass: #SlotWithAssertionExample
slots: { #value => SlotWithAssertion inv: [ :t | t isInteger ] }
classVariables: { }
category: 'Assertalk-Tests'
assigning non-integer objects to the value will raise a SlotAssertionFailure exception.
value := 1. self assert: [value = 1] value := 'abc'. "==> SlotAssertionFailure"
An erroneous assignment can be rolled back.
value := 1. [value := 'abc'] on: SlotAssertionFailure do: [:ex | ex rollback]. self assert: [value = 1].
