Add test for NSMutableString -> kotlin.String -> NSString conversion
This commit is contained in:
committed by
SvyatoslavScherbina
parent
e24effd4c0
commit
57ada1c2cb
@@ -1030,6 +1030,14 @@ __attribute__((swift_name("GH3525")))
|
|||||||
+ (instancetype)gH3525 __attribute__((swift_name("init()")));
|
+ (instancetype)gH3525 __attribute__((swift_name("init()")));
|
||||||
@end;
|
@end;
|
||||||
|
|
||||||
|
__attribute__((objc_subclassing_restricted))
|
||||||
|
__attribute__((swift_name("TestStringConversion")))
|
||||||
|
@interface ValuesTestStringConversion : ValuesBase
|
||||||
|
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||||
|
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||||
|
@property id str __attribute__((swift_name("str")));
|
||||||
|
@end;
|
||||||
|
|
||||||
@interface ValuesEnumeration (ValuesKt)
|
@interface ValuesEnumeration (ValuesKt)
|
||||||
- (ValuesEnumeration *)getAnswer __attribute__((swift_name("getAnswer()")));
|
- (ValuesEnumeration *)getAnswer __attribute__((swift_name("getAnswer()")));
|
||||||
@end;
|
@end;
|
||||||
|
|||||||
@@ -826,4 +826,8 @@ object GH3525 : GH3525Base() {
|
|||||||
init {
|
init {
|
||||||
gh3525InitCount++
|
gh3525InitCount++
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TestStringConversion {
|
||||||
|
lateinit var str: Any
|
||||||
}
|
}
|
||||||
@@ -1077,6 +1077,19 @@ func testGH3525() throws {
|
|||||||
try assertTrue(gh3525_1 === gh3525_2)
|
try assertTrue(gh3525_1 === gh3525_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testStringConversion() throws {
|
||||||
|
let test = TestStringConversion()
|
||||||
|
|
||||||
|
let buffer = NSMutableString()
|
||||||
|
buffer.append("a")
|
||||||
|
test.str = buffer
|
||||||
|
buffer.append("b")
|
||||||
|
|
||||||
|
try assertEquals(actual: buffer, expected: "ab")
|
||||||
|
// Ensure test.str isn't affected by buffer mutation:
|
||||||
|
try assertEquals(actual: test.str as! NSString, expected: "a")
|
||||||
|
}
|
||||||
|
|
||||||
// -------- Execution of the test --------
|
// -------- Execution of the test --------
|
||||||
|
|
||||||
class ValuesTests : TestProvider {
|
class ValuesTests : TestProvider {
|
||||||
@@ -1132,6 +1145,7 @@ class ValuesTests : TestProvider {
|
|||||||
TestCase(name: "TestGH3503_2", method: withAutorelease(testGH3503_2)),
|
TestCase(name: "TestGH3503_2", method: withAutorelease(testGH3503_2)),
|
||||||
TestCase(name: "TestGH3503_3", method: withAutorelease(testGH3503_3)),
|
TestCase(name: "TestGH3503_3", method: withAutorelease(testGH3503_3)),
|
||||||
TestCase(name: "TestGH3525", method: withAutorelease(testGH3525)),
|
TestCase(name: "TestGH3525", method: withAutorelease(testGH3525)),
|
||||||
|
TestCase(name: "TestStringConversion", method: withAutorelease(testStringConversion)),
|
||||||
|
|
||||||
// Stress test, must remain the last one:
|
// Stress test, must remain the last one:
|
||||||
TestCase(name: "TestGH2931", method: withAutorelease(testGH2931)),
|
TestCase(name: "TestGH2931", method: withAutorelease(testGH2931)),
|
||||||
|
|||||||
Reference in New Issue
Block a user