/interpreter/tags/at2dist041108/test/edu/vub/at/objects/natives/ExceptionHandlingTest-snippet1

http://ambienttalk.googlecode.com/ · #! · 23 lines · 21 code · 2 blank · 0 comment · 0 complexity · 2e045baf7771cb293555db23c0d15dd1 MD5 · raw file

  1. def 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. def test := object: {
  18. def visible := nil
  19. } mirroredBy: removableFieldsMirror;
  20. (reflect: test).removeField(`visible);
  21. (test.visible == nil).ifTrue: { fail(); };