// RUN: %empty-directory(%t) // // RUN: cp %s %t/main.swift // RUN: %target-clang %S/Inputs/OldABI/OldABI.mm -g -c -o %t/OldABI.o // RUN: %target-build-swift %t/main.swift -framework Foundation -I %S/Inputs/OldABI/ -Xlinker %t/OldABI.o -o %t/objc_old_swift -Xfrontend -disable-access-control // RUN: %target-codesign %t/objc_old_swift // RUN: %target-run %t/objc_old_swift // REQUIRES: executable_test // REQUIRES: objc_interop // The bit twiddling done by this test falls afoul of ptrauth on ARM64e. We // don't support pre-stable Swift ABI code on ARM64e anyway, so just disable the // test there. // UNSUPPORTED: CPU=arm64e // Verify that objects that appear to be from the pre-stable Swift ABI // are correctly ignored by stable Swift's entry points. import Foundation import OldABI import StdlibUnittest var tests = TestSuite("objc_old_swift") tests.test("description") .skip(.custom({ !CanTestOldABI() }, reason: "not using stable ABI's is-Swift bit yet")) .code { let obj = AllocOldABIObject() expectEqual(String(describing:obj), "OldABI.Subclass") expectEqual((obj as AnyObject).description!, "FakeSwiftObject instance") } tests.test("casts") .skip(.custom({ !CanTestOldABI() }, reason: "not using stable ABI's is-Swift bit yet")) .code { let obj = AllocOldABIObject() expectNil(obj as? String) expectNotNil(obj as Any) expectNotNil(obj as AnyObject) } tests.test("array") .skip(.custom({ !CanTestOldABI() }, reason: "not using stable ABI's is-Swift bit yet")) .code { let array = Array(repeating: AllocOldABIObject(), count:5) expectEqual(String(describing: array), "[OldABI.Subclass, OldABI.Subclass, OldABI.Subclass, OldABI.Subclass, OldABI.Subclass]") var array2 = Array(repeating: AllocOldABIObject(), count:0) for i in 0..