Files
swift-mirror/test/Interpreter/SDK/weak_objc_interop.swift
Arnold Schwaighofer 3643c614a3 Run tests in optimize test modes
This runs all files that have a target-build-swift or target-run-stdlib-swift
RUN line in optimize test mode.

Swift SVN r29206
2015-06-01 21:23:31 +00:00

31 lines
847 B
Swift

// Also run this test in optimize test modes.
// REQUIRES: optimize_test
// RUN: rm -rf %t
// RUN: mkdir -p %t
//
// RUN: cp %s %t/main.swift
// RUN: %target-clang -fobjc-arc %S/Inputs/ObjCWeak/ObjCWeak.m -c -o %t/ObjCWeak.o
// RUN: %target-build-swift %t/main.swift -I %S/Inputs/ObjCWeak/ -Xlinker %t/ObjCWeak.o -o %t/weak_objc_interop -Xfrontend -disable-access-control
// RUN: %target-run %t/weak_objc_interop 2>&1 | FileCheck %s
// REQUIRES: objc_interop
import Foundation
import ObjCWeak
// Test that instances of pure Swift classes can be referenced using ObjC
// weak references.
class C {
@objc var description: String {
return "Swift Object"
}
}
tryWeakReferencing { C() }
// CHECK: before giving up strong reference:
// CHECK-NEXT: Swift Object
// CHECK-NEXT: after giving up strong reference:
// CHECK-NEXT: Gone