Quick / Nimble

A Matcher Framework for Swift and Objective-C

Home Page:https://quick.github.io/Nimble/documentation/nimble/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Objective-C counterpart for variadic argument `contain` matcher in Swift

modocache opened this issue · comments

I can write the following, very convenient, assertion in Swift:

// Swift

expect(["whale", "dolphin", "starfish"]).to(contain("dolphin", "starfish"))

But in Objective-C, I can't pass multiple arguments to contain, so I have to write two lines:

// Objective-C

expect(@[@"whale", @"dolphin", @"starfish"]).to(contain(@"dolphin"));
expect(@[@"whale", @"dolphin", @"starfish"]).to(contain(@"starfish"));

It'd be nice if Objective-C contain supported multiple arguments somehow (the same goes for beginWith and endWith).

For any of these matchers supporting multiple arguments, they need to be converted into a macro that implicitly wraps the arguments into arrays.