/interpreter/tags/reactive-pattern-matching/test/edu/vub/at/objects/natives/ExceptionHandlingTest-snippet1
#! | 23 lines | 21 code | 2 blank | 0 comment | 0 complexity | 2e045baf7771cb293555db23c0d15dd1 MD5 | raw file
1def removableFieldsMirror := 2 mirror: { 3 // vectors are not loaded with these unit tests 4 // we therefore assume only a single field is removed 5 def removedField := nil; 6 def removeField( symbol ) { 7 removedField := symbol; 8 }; 9 def invokeField( receiver, symbol ) { 10 if: (symbol == removedField) then: { 11 raise: doesNotUnderstandX.new(symbol , self); 12 } else: { 13 super.invokeField( receiver, symbol ); 14 } 15 } 16 }; 17 18def test := object: { 19 def visible := nil 20} mirroredBy: removableFieldsMirror; 21 22(reflect: test).removeField(`visible); 23(test.visible == nil).ifTrue: { fail(); };