-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite tests to new swift-testing framework
Fixes actor isolation issues with XCTestCase.
- Loading branch information
1 parent
5d7ed95
commit 2e5981d
Showing
14 changed files
with
609 additions
and
638 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
import Foundation | ||
import Testing | ||
@testable import Parchment | ||
import XCTest | ||
|
||
final class PagingDataTests: XCTestCase { | ||
var visibleItems: PagingItems! | ||
struct PagingDataTests { | ||
private let visibleItems: PagingItems | ||
|
||
override func setUp() { | ||
init() { | ||
visibleItems = PagingItems(items: [ | ||
Item(index: 0), | ||
Item(index: 1), | ||
Item(index: 2), | ||
]) | ||
} | ||
|
||
func testIndexPathForPagingItemFound() { | ||
@Test func indexPathForPagingItemFound() { | ||
let indexPath = visibleItems.indexPath(for: Item(index: 0))! | ||
XCTAssertEqual(indexPath.item, 0) | ||
#expect(indexPath.item == 0) | ||
} | ||
|
||
func testIndexPathForPagingItemMissing() { | ||
@Test func indexPathForPagingItemMissing() { | ||
let indexPath = visibleItems.indexPath(for: Item(index: -1)) | ||
XCTAssertNil(indexPath) | ||
#expect(indexPath == nil) | ||
} | ||
|
||
func testPagingItemForIndexPath() { | ||
@Test func pagingItemForIndexPath() { | ||
let indexPath = IndexPath(item: 0, section: 0) | ||
let pagingItem = visibleItems.pagingItem(for: indexPath) as! Item | ||
XCTAssertEqual(pagingItem, Item(index: 0)) | ||
#expect(pagingItem == Item(index: 0)) | ||
} | ||
|
||
func testDirectionForIndexPathForward() { | ||
@Test func directionForIndexPathForward() { | ||
let currentPagingItem = Item(index: 0) | ||
let upcomingPagingItem = Item(index: 1) | ||
let direction = visibleItems.direction(from: currentPagingItem, to: upcomingPagingItem) | ||
XCTAssertEqual(direction, PagingDirection.forward(sibling: true)) | ||
#expect(direction == PagingDirection.forward(sibling: true)) | ||
} | ||
|
||
func testDirectionForIndexPathReverse() { | ||
@Test func directionForIndexPathReverse() { | ||
let currentPagingItem = Item(index: 1) | ||
let upcomingPagingItem = Item(index: 0) | ||
let direction = visibleItems.direction(from: currentPagingItem, to: upcomingPagingItem) | ||
XCTAssertEqual(direction, PagingDirection.reverse(sibling: true)) | ||
#expect(direction == PagingDirection.reverse(sibling: true)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.