@@ -417,8 +417,8 @@ struct GeneratedCommands {
417
417
try await connection. subscribe ( to: " testSubscriptions " ) { subscription in
418
418
cont. finish ( )
419
419
var iterator = subscription. makeAsyncIterator ( )
420
- await #expect( throws: Never . self) { try await iterator. next ( ) ? . message == " hello " }
421
- await #expect( throws: Never . self) { try await iterator. next ( ) ? . message == " goodbye " }
420
+ await #expect( throws: Never . self) { try await iterator. next ( ) . map { String ( buffer : $0 . message) } == " hello " }
421
+ await #expect( throws: Never . self) { try await iterator. next ( ) . map { String ( buffer : $0 . message) } == " goodbye " }
422
422
}
423
423
#expect( await connection. isSubscriptionsEmpty ( ) )
424
424
}
@@ -450,14 +450,14 @@ struct GeneratedCommands {
450
450
try await connection. subscribe ( to: " testDoubleSubscription " ) { stream2 in
451
451
var iterator2 = stream2. makeAsyncIterator ( )
452
452
cont. yield ( )
453
- await #expect( throws: Never . self) { try await iterator. next ( ) ? . message == " hello " }
454
- await #expect( throws: Never . self) { try await iterator2. next ( ) ? . message == " hello " }
453
+ await #expect( throws: Never . self) { try await iterator. next ( ) . map { String ( buffer : $0 . message) } == " hello " }
454
+ await #expect( throws: Never . self) { try await iterator2. next ( ) . map { String ( buffer : $0 . message) } == " hello " }
455
455
// ensure we only see the message once, by waiting for second message.
456
- await #expect( throws: Never . self) { try await iterator. next ( ) ? . message == " world " }
457
- await #expect( throws: Never . self) { try await iterator2. next ( ) ? . message == " world " }
456
+ await #expect( throws: Never . self) { try await iterator. next ( ) . map { String ( buffer : $0 . message) } == " world " }
457
+ await #expect( throws: Never . self) { try await iterator2. next ( ) . map { String ( buffer : $0 . message) } == " world " }
458
458
}
459
459
cont. yield ( )
460
- await #expect( throws: Never . self) { try await iterator. next ( ) ? . message == " ! " }
460
+ await #expect( throws: Never . self) { try await iterator. next ( ) . map { String ( buffer : $0 . message) } == " ! " }
461
461
}
462
462
#expect( await connection. isSubscriptionsEmpty ( ) )
463
463
}
@@ -489,8 +489,8 @@ struct GeneratedCommands {
489
489
var iterator = stream. makeAsyncIterator ( )
490
490
var iterator2 = stream2. makeAsyncIterator ( )
491
491
cont. finish ( )
492
- await #expect( throws: Never . self) { try await iterator. next ( ) ? . message == " hello " }
493
- await #expect( throws: Never . self) { try await iterator2. next ( ) ? . message == " goodbye " }
492
+ await #expect( throws: Never . self) { try await iterator. next ( ) . map { String ( buffer : $0 . message) } == " hello " }
493
+ await #expect( throws: Never . self) { try await iterator2. next ( ) . map { String ( buffer : $0 . message) } == " goodbye " }
494
494
}
495
495
}
496
496
#expect( await connection. isSubscriptionsEmpty ( ) )
@@ -520,9 +520,9 @@ struct GeneratedCommands {
520
520
try await connection. subscribe ( to: " multi1 " , " multi2 " , " multi3 " ) { stream in
521
521
var iterator = stream. makeAsyncIterator ( )
522
522
cont. yield ( )
523
- await #expect( throws: Never . self) { try await iterator. next ( ) ? . message == " 1 " }
524
- await #expect( throws: Never . self) { try await iterator. next ( ) ? . message == " 2 " }
525
- await #expect( throws: Never . self) { try await iterator. next ( ) ? . message == " 3 " }
523
+ await #expect( throws: Never . self) { try await iterator. next ( ) . map { String ( buffer : $0 . message) } == " 1 " }
524
+ await #expect( throws: Never . self) { try await iterator. next ( ) . map { String ( buffer : $0 . message) } == " 2 " }
525
+ await #expect( throws: Never . self) { try await iterator. next ( ) . map { String ( buffer : $0 . message) } == " 3 " }
526
526
}
527
527
#expect( await connection. isSubscriptionsEmpty ( ) )
528
528
}
@@ -584,7 +584,9 @@ struct GeneratedCommands {
584
584
var iterator = stream. makeAsyncIterator ( )
585
585
var iterator2 = stream2. makeAsyncIterator ( )
586
586
cont. finish ( )
587
- try #expect( await iterator. next ( ) == . init( channel: " PatternChannelSubscriptions1 " , message: " hello " ) )
587
+ try #expect(
588
+ await iterator. next ( ) == . init( channel: " PatternChannelSubscriptions1 " , message: " hello " )
589
+ )
588
590
try #expect( await iterator2. next ( ) == . init( channel: " PatternChannelSubscriptions1 " , message: " hello " ) )
589
591
try #expect( await iterator2. next ( ) == . init( channel: " PatternChannelSubscriptions2 " , message: " goodbye " ) )
590
592
}
@@ -645,15 +647,15 @@ struct GeneratedCommands {
645
647
try await connection. subscribe ( to: " testSubscriptions " ) { subscription in
646
648
cont. finish ( )
647
649
var iterator = subscription. makeAsyncIterator ( )
648
- await #expect( throws: Never . self) { try await iterator. next ( ) ? . message == " hello " }
650
+ await #expect( throws: Never . self) { try await iterator. next ( ) . map { String ( buffer : $0 . message) } == " hello " }
649
651
// test we can send commands on subscription connection
650
652
try await withKey ( connection: connection) { key in
651
653
_ = try await connection. set ( key: key, value: " Hello " )
652
654
let response = try await connection. get ( key: key)
653
655
#expect( response. map { String ( buffer: $0) } == " Hello " )
654
656
}
655
657
656
- await #expect( throws: Never . self) { try await iterator. next ( ) ? . message == " goodbye " }
658
+ await #expect( throws: Never . self) { try await iterator. next ( ) . map { String ( buffer : $0 . message) } == " goodbye " }
657
659
}
658
660
#expect( await connection. isSubscriptionsEmpty ( ) )
659
661
}
@@ -715,10 +717,10 @@ struct GeneratedCommands {
715
717
var iterator = subscription. makeAsyncIterator ( )
716
718
var value = try await iterator. next ( )
717
719
#expect( value? . channel == " __keyspace@0__: \( key) " )
718
- #expect( value? . message == " set " )
720
+ #expect( value. map { String ( buffer : $0 . message) } == " set " )
719
721
value = try await iterator. next ( )
720
722
#expect( value? . channel == " __keyspace@0__: \( key) " )
721
- #expect( value? . message == " incrby " )
723
+ #expect( value. map { String ( buffer : $0 . message) } == " incrby " )
722
724
}
723
725
}
724
726
}
0 commit comments