extend String def foo as String ensure result.length == .length result == 'x' body return .toLower class X def main is shared s = 'x' s = s.foo s = 'y' expect EnsureException, s = s.foo