Files
swift-mirror/test/ClangModules/Security_test.swift
Chris Lattner 31c01eab73 Change the meaning of "if let x = foo()" back to Xcode 6.4 semantics. The compiler
includes a number of QoI things to help people write the correct code.  I will commit
the testcase for it as the next patch.

The bulk of this patch is moving the stdlib, testsuite and validation testsuite to
the new syntax.  I moved a few uses of "as" patterns back to as? expressions in the 
stdlib as well.



Swift SVN r27959
2015-04-30 04:38:13 +00:00

31 lines
916 B
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse %s -verify
// REQUIRES: objc_interop
import Security
let _: CFStringRef = kSecClass
let _: CFStringRef = kSecClassGenericPassword
let _: CFDictionaryRef = kSecClassGenericPassword // expected-error {{'CFStringRef' is not convertible to 'CFDictionaryRef'}}
func testIntegration() {
// Based on code in <rdar://problem/17162475>.
let query = [kSecClass as NSString: kSecClassGenericPassword] as NSDictionary as CFDictionary
var dataTypeRef: Unmanaged<AnyObject>? = nil
let status = SecItemCopyMatching(query, &dataTypeRef)
if status == errSecSuccess {
if let filledRef = dataTypeRef {
let str: NSString = filledRef.takeRetainedValue() as! NSString
println("Got: \(str)")
}
}
}
func testAuthorizationIsNotCF() {
var auth = AuthorizationRef()
_ = AuthorizationCreate(&auth)
_ = AuthorizationFree(auth)
}