@@ -522,93 +522,129 @@ StringTests.test("_isIdentical(to:)") {
522522 expectTrue ( g. _isIdentical ( to: g) )
523523}
524524
525- StringTests . test ( " String.UnicodeScalarView.isTriviallyIdentical(to:) " ) {
526- let a = " Hello " . unicodeScalars
527- let b = " Hello " . unicodeScalars
528- expectTrue ( a. isTriviallyIdentical ( to: a) )
529- expectTrue ( b. isTriviallyIdentical ( to: b) )
530- expectTrue ( a. isTriviallyIdentical ( to: b) )
531- expectTrue ( b. isTriviallyIdentical ( to: a) )
532-
533- let c = " Abcde " . unicodeScalars
534- expectFalse ( a. isTriviallyIdentical ( to: c) )
535- expectFalse ( c. isTriviallyIdentical ( to: a) )
536- }
537- StringTests . test ( " String.UTF8View.isTriviallyIdentical(to:) " ) {
538- let a = " Hello " . utf8
539- let b = " Hello " . utf8
540- expectTrue ( a. isTriviallyIdentical ( to: a) )
541- expectTrue ( b. isTriviallyIdentical ( to: b) )
542- expectTrue ( a. isTriviallyIdentical ( to: b) )
543- expectTrue ( b. isTriviallyIdentical ( to: a) )
544-
545-
546- let c = " Abcde " . utf8
547- expectFalse ( a. isTriviallyIdentical ( to: c) )
548- expectFalse ( c. isTriviallyIdentical ( to: a) )
549- }
550- StringTests . test ( " String.UTF16View.isTriviallyIdentical(to:) " ) {
551- let a = " Hello " . utf16
552- let b = " Hello " . utf16
553- expectTrue ( a. isTriviallyIdentical ( to: a) )
554- expectTrue ( b. isTriviallyIdentical ( to: b) )
555- expectTrue ( a. isTriviallyIdentical ( to: b) )
556- expectTrue ( b. isTriviallyIdentical ( to: a) )
557-
558-
559- let c = " Abcde " . utf16
560- expectFalse ( a. isTriviallyIdentical ( to: c) )
561- expectFalse ( c. isTriviallyIdentical ( to: a) )
562- }
525+ StringTests . test ( " String.UnicodeScalarView.isTriviallyIdentical(to:) " )
526+ . skip ( . custom( {
527+ if #available( SwiftStdlib 6 . 3 , * ) { false } else { true }
528+ } , reason: " Requires Swift stdlib 6.3 " ) )
529+ . code {
530+ guard #available( SwiftStdlib 6 . 3 , * ) else { return }
531+
532+ let a = " Hello " . unicodeScalars
533+ let b = " Hello " . unicodeScalars
534+ expectTrue ( a. isTriviallyIdentical ( to: a) )
535+ expectTrue ( b. isTriviallyIdentical ( to: b) )
536+ expectTrue ( a. isTriviallyIdentical ( to: b) )
537+ expectTrue ( b. isTriviallyIdentical ( to: a) )
538+
539+ let c = " Abcde " . unicodeScalars
540+ expectFalse ( a. isTriviallyIdentical ( to: c) )
541+ expectFalse ( c. isTriviallyIdentical ( to: a) )
542+ }
543+ StringTests . test ( " String.UTF8View.isTriviallyIdentical(to:) " )
544+ . skip ( . custom( {
545+ if #available( SwiftStdlib 6 . 3 , * ) { false } else { true }
546+ } , reason: " Requires Swift stdlib 6.3 " ) )
547+ . code {
548+ guard #available( SwiftStdlib 6 . 3 , * ) else { return }
549+
550+ let a = " Hello " . utf8
551+ let b = " Hello " . utf8
552+ expectTrue ( a. isTriviallyIdentical ( to: a) )
553+ expectTrue ( b. isTriviallyIdentical ( to: b) )
554+ expectTrue ( a. isTriviallyIdentical ( to: b) )
555+ expectTrue ( b. isTriviallyIdentical ( to: a) )
556+
557+
558+ let c = " Abcde " . utf8
559+ expectFalse ( a. isTriviallyIdentical ( to: c) )
560+ expectFalse ( c. isTriviallyIdentical ( to: a) )
561+ }
562+ StringTests . test ( " String.UTF16View.isTriviallyIdentical(to:) " )
563+ . skip ( . custom( {
564+ if #available( SwiftStdlib 6 . 3 , * ) { false } else { true }
565+ } , reason: " Requires Swift stdlib 6.3 " ) )
566+ . code {
567+ guard #available( SwiftStdlib 6 . 3 , * ) else { return }
568+
569+ let a = " Hello " . utf16
570+ let b = " Hello " . utf16
571+ expectTrue ( a. isTriviallyIdentical ( to: a) )
572+ expectTrue ( b. isTriviallyIdentical ( to: b) )
573+ expectTrue ( a. isTriviallyIdentical ( to: b) )
574+ expectTrue ( b. isTriviallyIdentical ( to: a) )
575+
576+
577+ let c = " Abcde " . utf16
578+ expectFalse ( a. isTriviallyIdentical ( to: c) )
579+ expectFalse ( c. isTriviallyIdentical ( to: a) )
580+ }
563581
564- StringTests . test ( " Substring.UnicodeScalarView.isTriviallyIdentical(to:) " ) {
565- let base1 = " Test String "
566- let a = base1 [ base1. index ( base1. startIndex, offsetBy: 5 ) ..< base1. endIndex]
567- . unicodeScalars
568- let b = base1 [ base1. index ( base1. startIndex, offsetBy: 5 ) ..< base1. endIndex]
569- . unicodeScalars
570- expectTrue ( a. isTriviallyIdentical ( to: a) )
571- expectTrue ( b. isTriviallyIdentical ( to: b) )
572- expectTrue ( a. isTriviallyIdentical ( to: b) )
573- expectTrue ( b. isTriviallyIdentical ( to: a) )
574-
575- let c = base1 [ base1. startIndex..< base1. index ( base1. startIndex, offsetBy: 5 ) ]
576- . unicodeScalars
577- expectFalse ( a. isTriviallyIdentical ( to: c) )
578- expectFalse ( c. isTriviallyIdentical ( to: a) )
579- }
580- StringTests . test ( " Substring.UTF8View.isTriviallyIdentical(to:) " ) {
581- let base1 = " Test String "
582- let a = base1 [ base1. index ( base1. startIndex, offsetBy: 5 ) ..< base1. endIndex]
583- . utf8
584- let b = base1 [ base1. index ( base1. startIndex, offsetBy: 5 ) ..< base1. endIndex]
585- . utf8
586- expectTrue ( a. isTriviallyIdentical ( to: a) )
587- expectTrue ( b. isTriviallyIdentical ( to: b) )
588- expectTrue ( a. isTriviallyIdentical ( to: b) )
589- expectTrue ( b. isTriviallyIdentical ( to: a) )
590-
591- let c = base1 [ base1. startIndex..< base1. index ( base1. startIndex, offsetBy: 5 ) ]
592- . utf8
593- expectFalse ( a. isTriviallyIdentical ( to: c) )
594- expectFalse ( c. isTriviallyIdentical ( to: a) )
595- }
596- StringTests . test ( " Substring.UTF16View.isTriviallyIdentical(to:) " ) {
597- let base1 = " Test String "
598- let a = base1 [ base1. index ( base1. startIndex, offsetBy: 5 ) ..< base1. endIndex]
599- . utf16
600- let b = base1 [ base1. index ( base1. startIndex, offsetBy: 5 ) ..< base1. endIndex]
601- . utf16
602- expectTrue ( a. isTriviallyIdentical ( to: a) )
603- expectTrue ( b. isTriviallyIdentical ( to: b) )
604- expectTrue ( a. isTriviallyIdentical ( to: b) )
605- expectTrue ( b. isTriviallyIdentical ( to: a) )
606-
607- let c = base1 [ base1. startIndex..< base1. index ( base1. startIndex, offsetBy: 5 ) ]
608- . utf16
609- expectFalse ( a. isTriviallyIdentical ( to: c) )
610- expectFalse ( c. isTriviallyIdentical ( to: a) )
611- }
582+ StringTests . test ( " Substring.UnicodeScalarView.isTriviallyIdentical(to:) " )
583+ . skip ( . custom( {
584+ if #available( SwiftStdlib 6 . 3 , * ) { false } else { true }
585+ } , reason: " Requires Swift stdlib 6.3 " ) )
586+ . code {
587+ guard #available( SwiftStdlib 6 . 3 , * ) else { return }
588+
589+ let base1 = " Test String "
590+ let a = base1 [ base1. index ( base1. startIndex, offsetBy: 5 ) ..< base1. endIndex]
591+ . unicodeScalars
592+ let b = base1 [ base1. index ( base1. startIndex, offsetBy: 5 ) ..< base1. endIndex]
593+ . unicodeScalars
594+ expectTrue ( a. isTriviallyIdentical ( to: a) )
595+ expectTrue ( b. isTriviallyIdentical ( to: b) )
596+ expectTrue ( a. isTriviallyIdentical ( to: b) )
597+ expectTrue ( b. isTriviallyIdentical ( to: a) )
598+
599+ let c = base1 [ base1. startIndex..< base1. index ( base1. startIndex, offsetBy: 5 ) ]
600+ . unicodeScalars
601+ expectFalse ( a. isTriviallyIdentical ( to: c) )
602+ expectFalse ( c. isTriviallyIdentical ( to: a) )
603+ }
604+ StringTests . test ( " Substring.UTF8View.isTriviallyIdentical(to:) " )
605+ . skip ( . custom( {
606+ if #available( SwiftStdlib 6 . 3 , * ) { false } else { true }
607+ } , reason: " Requires Swift stdlib 6.3 " ) )
608+ . code {
609+ guard #available( SwiftStdlib 6 . 3 , * ) else { return }
610+
611+ let base1 = " Test String "
612+ let a = base1 [ base1. index ( base1. startIndex, offsetBy: 5 ) ..< base1. endIndex]
613+ . utf8
614+ let b = base1 [ base1. index ( base1. startIndex, offsetBy: 5 ) ..< base1. endIndex]
615+ . utf8
616+ expectTrue ( a. isTriviallyIdentical ( to: a) )
617+ expectTrue ( b. isTriviallyIdentical ( to: b) )
618+ expectTrue ( a. isTriviallyIdentical ( to: b) )
619+ expectTrue ( b. isTriviallyIdentical ( to: a) )
620+
621+ let c = base1 [ base1. startIndex..< base1. index ( base1. startIndex, offsetBy: 5 ) ]
622+ . utf8
623+ expectFalse ( a. isTriviallyIdentical ( to: c) )
624+ expectFalse ( c. isTriviallyIdentical ( to: a) )
625+ }
626+ StringTests . test ( " Substring.UTF16View.isTriviallyIdentical(to:) " )
627+ . skip ( . custom( {
628+ if #available( SwiftStdlib 6 . 3 , * ) { false } else { true }
629+ } , reason: " Requires Swift stdlib 6.3 " ) )
630+ . code {
631+ guard #available( SwiftStdlib 6 . 3 , * ) else { return }
632+
633+ let base1 = " Test String "
634+ let a = base1 [ base1. index ( base1. startIndex, offsetBy: 5 ) ..< base1. endIndex]
635+ . utf16
636+ let b = base1 [ base1. index ( base1. startIndex, offsetBy: 5 ) ..< base1. endIndex]
637+ . utf16
638+ expectTrue ( a. isTriviallyIdentical ( to: a) )
639+ expectTrue ( b. isTriviallyIdentical ( to: b) )
640+ expectTrue ( a. isTriviallyIdentical ( to: b) )
641+ expectTrue ( b. isTriviallyIdentical ( to: a) )
642+
643+ let c = base1 [ base1. startIndex..< base1. index ( base1. startIndex, offsetBy: 5 ) ]
644+ . utf16
645+ expectFalse ( a. isTriviallyIdentical ( to: c) )
646+ expectFalse ( c. isTriviallyIdentical ( to: a) )
647+ }
612648
613649StringTests . test ( " hasPrefix/hasSuffix vs Character boundaries " ) {
614650 // https://github.com/apple/swift/issues/67427
0 commit comments