""" Test the invocation of the various Delegate static methods such as .combine, .remove and .removeAll. """ sig Handler(obj as Object) class Program shared var _got = List() def main h1 = Handler(ref .foo) h1('aoeu') .check('aoeu') h2 = Handler(ref .foo) h2('asdf') .check('aoeu', 'asdf') h = Delegate.combine(h1, h2) to Handler assert h.getInvocationList.length == 2 assert h.getInvocationList[0] == h1 assert h.getInvocationList[1] == h2 _got.clear h(5) .check(5, 5) removed = Delegate.remove(h, Handler(ref .foo)) assert removed.getInvocationList.length == 1 assert Delegate.removeAll(h, h1) is nil def foo(obj as Object) _got.add(obj) def check(things as vari Object) assert things == _got