Skip to content

Commit 50c79f9

Browse files
authored
Fix tests on older/32 bit platforms (#60538)
(cherry picked from commit 503a17c)
1 parent e5a35f9 commit 50c79f9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

test/Inputs/SmallStringTestUtilities.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ extension _SmallString {
7575
return nil
7676
#else
7777
guard _isObjCTaggedPointer(ns) else { return nil }
78-
self.init(taggedCocoa: ns)
78+
self = (ns as String)._guts.asSmall //regular tagged NSStrings are guaranteed to bridge to SmallStrings
79+
assert(_StringGuts(self).isSmall)
7980
#endif
8081
}
8182
#endif

test/stdlib/NSSlowTaggedLocalizedString.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ let longTaggedTests = TestSuite("NonContiguousTaggedStrings")
1616
var constant = "Send Message to different Team"
1717

1818
func runEqualLongTagged() {
19+
20+
if MemoryLayout<AnyObject>.size != 8 {
21+
return //no tagged pointers
22+
}
23+
1924
let native = constant.withUTF8 { String(decoding: $0, as: UTF8.self) }
2025
let longTagged = NSSlowTaggedLocalizedString.createTest()!
2126
constant.withCString {

0 commit comments

Comments
 (0)