Skip to content

Commit 266405c

Browse files
committed
testDiscovery() needs to enumerate only once because it's a sequence, not a collection, and may not be enumerable twice--cast to array for the bulk of the test
1 parent a15fca2 commit 266405c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Tests/TestingTests/MiscellaneousTests.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,14 +629,15 @@ struct MiscellaneousTests {
629629

630630
@Test func testDiscovery() async {
631631
// Check the type of the test record sequence (it should be lazy.)
632-
let allRecords = DiscoverableTestContent.allTestContentRecords()
632+
let allRecordsSeq = DiscoverableTestContent.allTestContentRecords()
633633
#if SWT_FIXED_143080508
634-
#expect(allRecords is any LazySequenceProtocol)
635-
#expect(!(allRecords is [TestContentRecord<DiscoverableTestContent>]))
634+
#expect(allRecordsSeq is any LazySequenceProtocol)
635+
#expect(!(allRecordsSeq is [TestContentRecord<DiscoverableTestContent>]))
636636
#endif
637637

638638
// It should have exactly one matching record (because we only emitted one.)
639-
#expect(Array(allRecords).count == 1)
639+
let allRecords = Array(allRecordsSeq)
640+
#expect(allRecords.count == 1)
640641

641642
// Can find a single test record
642643
#expect(allRecords.contains { record in

0 commit comments

Comments
 (0)