Update test to remove dependency on Foundation.

Using APIs from Foundation and the standard library can be a source of
pain and can create fragile tests due to API changes. This reduces the
test case to pure swift and eliminates the use of the standard library APIs.
This commit is contained in:
Mark Sands
2016-04-21 10:19:10 -05:00
parent 01fb8cfebf
commit dcc1baec43

View File

@@ -4,22 +4,17 @@
// RUN: %target-swift-frontend -parse -primary-file %t/main.swift -emit-reference-dependencies-path - > %t.swiftdeps
// SR-1267, SR-1270
import Foundation
class TypeType<T> { }
protocol ProtocolType {}
class TypeType<T where T: NSString> {
func call(notification: NSNotification?) {
let set = NSOrderedSet()
if let objects = set.array as? [T] {
let _ = (notification?.userInfo?["great_key"] as? NSSet).flatMap { updatedObjects in
return updatedObjects.filter({ element in
guard let element = element as? T
where objects.index(of: element) != nil
else {
return false
}
return true
})
} ?? []
}
struct StructType<T> { }
extension StructType where T : ProtocolType {
func testCase<T>() -> TypeType<T> {
return TypeType<T>()
}
}
class TestView : ProtocolType {}
extension StructType where T : TestView {
var typeType : TypeType<T> { return testCase() }
}