mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-06 06:58:26 +00:00
Summary: I'm still not sure if there's an easier way to test throwing methods that work on both GitHub Actions and our internal build tooling (Since GitHub does throw at asserts, and our internal tools don't), but this way at least works. Each statement has to be contained in its own separate `try` because the first throwing method will cancel execution in the rest of the code block. This diff separates out each throwing test into its own `try` block Reviewed By: candance Differential Revision: D45147876 fbshipit-source-id: 95d587d5abe4a695b1ca1f76ebf3bda3984c6065
45 lines
1.4 KiB
Objective-C
45 lines
1.4 KiB
Objective-C
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import <XCTest/XCTest.h>
|
|
|
|
#import <IGListKit/IGListSectionController.h>
|
|
|
|
@interface IGListSectionControllerTests : XCTestCase
|
|
|
|
@end
|
|
|
|
@implementation IGListSectionControllerTests
|
|
|
|
- (void)test_withBaseSectionContoller_thatDefaultValuesAreCorrect {
|
|
NSObject *object = [NSObject new];
|
|
IGListSectionController *sectionController = [[IGListSectionController alloc] init];
|
|
XCTAssertNotNil(sectionController);
|
|
|
|
XCTAssertEqual([sectionController numberOfItems], 1);
|
|
XCTAssertTrue(CGSizeEqualToSize([sectionController sizeForItemAtIndex:0], CGSizeZero));
|
|
XCTAssertTrue([sectionController shouldSelectItemAtIndex:0]);
|
|
XCTAssertTrue([sectionController shouldDeselectItemAtIndex:0]);
|
|
XCTAssertFalse([sectionController canMoveItemAtIndex:0]);
|
|
|
|
[sectionController didUpdateToObject:object];
|
|
|
|
[sectionController didSelectItemAtIndex:0];
|
|
[sectionController didDeselectItemAtIndex:0];
|
|
[sectionController didHighlightItemAtIndex:0];
|
|
[sectionController didUnhighlightItemAtIndex:0];
|
|
|
|
@try {
|
|
[sectionController cellForItemAtIndex:0];
|
|
} @catch (NSException *exception) {}
|
|
|
|
@try {
|
|
[sectionController moveObjectFromIndex:0 toIndex:1];
|
|
} @catch (NSException *exception) {}
|
|
}
|
|
|
|
@end
|