fix bug: 'when' followed by 'test that' is not handled