mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Most of this is in updating the standard library, SDK overlays, and
piles of test cases to use the new names. No surprises here, although
this shows us some potential heuristic tweaks.
There is one substantive compiler change that needs to be factored out
involving synthesizing calls to copyWithZone()/copy(zone:). Aside from
that, there are four failing tests:
Swift :: ClangModules/objc_parse.swift
Swift :: Interpreter/SDK/Foundation_test.swift
Swift :: Interpreter/SDK/archiving_generic_swift_class.swift
Swift :: Interpreter/SDK/objc_currying.swift
due to two independent remaining compiler bugs:
* We're not getting partial ordering between NSCoder's
encode(AnyObject, forKey: String) and NSKeyedArchiver's version of
that method, and
* Dynamic lookup (into AnyObject) doesn't know how to find the new
names. We need the Swift name lookup tables enabled to address this.
93 lines
2.5 KiB
Swift
93 lines
2.5 KiB
Swift
// RUN: %target-run-simple-swift
|
|
// REQUIRES: executable_test
|
|
|
|
// REQUIRES: objc_interop
|
|
// UNSUPPORTED: OS=watchos
|
|
|
|
import StdlibUnittest
|
|
import GameplayKit
|
|
|
|
// GameplayKit is only available on iOS 9.0 and above, OS X 10.11 and above, and
|
|
// tvOS 9.0 and above.
|
|
|
|
var GamePlayKitTests = TestSuite("GameplayKit")
|
|
|
|
if #available(OSX 10.11, iOS 9.0, tvOS 9.0, *) {
|
|
|
|
class TestComponent : GKComponent {}
|
|
class OtherTestComponent : GKComponent {}
|
|
|
|
class TestState1 : GKState {}
|
|
class TestState2 : GKState {}
|
|
|
|
GamePlayKitTests.test("GKEntity.componentForClass()") {
|
|
let entity = GKEntity()
|
|
entity.addComponent(TestComponent())
|
|
|
|
if true {
|
|
var componentForTestComponent =
|
|
entity.componentForClass(TestComponent.self)
|
|
var componentForOtherTestComponent_nil =
|
|
entity.componentForClass(OtherTestComponent.self)
|
|
|
|
expectNotEmpty(componentForTestComponent)
|
|
expectType(Optional<TestComponent>.self, &componentForTestComponent)
|
|
|
|
expectEmpty(componentForOtherTestComponent_nil)
|
|
}
|
|
|
|
entity.removeComponentFor(TestComponent.self)
|
|
entity.addComponent(OtherTestComponent())
|
|
|
|
if true {
|
|
var componentForOtherTestComponent =
|
|
entity.componentForClass(OtherTestComponent.self)
|
|
var componentForTestComponent_nil =
|
|
entity.componentForClass(TestComponent.self)
|
|
|
|
expectNotEmpty(componentForOtherTestComponent)
|
|
expectType(Optional<OtherTestComponent>.self, &componentForOtherTestComponent)
|
|
|
|
expectEmpty(componentForTestComponent_nil)
|
|
}
|
|
}
|
|
|
|
GamePlayKitTests.test("GKStateMachine.stateForClass()") {
|
|
if true {
|
|
// Construct a state machine with a custom subclass as the only state.
|
|
let stateMachine = GKStateMachine(
|
|
states: [TestState1()])
|
|
|
|
var stateForTestState1 =
|
|
stateMachine.stateForClass(TestState1.self)
|
|
var stateForTestState2_nil =
|
|
stateMachine.stateForClass(TestState2.self)
|
|
|
|
expectNotEmpty(stateForTestState1)
|
|
expectType(Optional<TestState1>.self, &stateForTestState1)
|
|
|
|
expectEmpty(stateForTestState2_nil)
|
|
}
|
|
|
|
if true {
|
|
// Construct a state machine with a custom subclass as the only state.
|
|
let stateMachine = GKStateMachine(
|
|
states: [TestState2()])
|
|
|
|
var stateForTestState2 =
|
|
stateMachine.stateForClass(TestState2.self)
|
|
var stateForTestState1_nil =
|
|
stateMachine.stateForClass(TestState1.self)
|
|
|
|
expectNotEmpty(stateForTestState2)
|
|
expectType(Optional<TestState2>.self, &stateForTestState2)
|
|
|
|
expectEmpty(stateForTestState1_nil)
|
|
}
|
|
}
|
|
|
|
} // if #available(OSX 10.11, iOS 9.0, tvOS 9.0, *)
|
|
|
|
runAllTests()
|
|
|