jeudi 4 août 2016

How to assert that a function returns an array

I'm writing iOS unit tests for the first time and I'm having some trouble. When I write unit tests in PHP, I can also assert that the returned value of a function is - let's say - an array.

The code below worked, but that might not be the best way to do this, since the content of the array might change.

NSArray *first = [Example getArray];
NSArray *second = @[@"test", @"test2"];

XCTAssertEqualObjects(first, second, @"Example:getArray doesn't return an array.");

What's the proper way to do this in Objective-C?

Aucun commentaire:

Enregistrer un commentaire