forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNil.swift
39 lines (32 loc) · 926 Bytes
/
Nil.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// RUN: %target-run-simple-swift | FileCheck %s
import Foundation
let opaqueNil: COpaquePointer = nil
if opaqueNil == nil {
println("ok opaqueNil == nil")
// CHECK: ok opaqueNil == nil
}
if opaqueNil != nil {
} else {
println("ok opaqueNil != nil is false")
// CHECK: ok opaqueNil != nil is false
}
let unsafeNil: UnsafeMutablePointer<Int> = nil
if unsafeNil == (nil as UnsafeMutablePointer<Int>) {
println("ok unsafeNil == (nil as UnsafeMutablePointer<Int>)")
// CHECK: ok unsafeNil == (nil as UnsafeMutablePointer<Int>)
}
let removed = NSFileManager.defaultManager().removeItemAtURL(NSURL(string:"/this/file/does/not/exist")!, error:nil)
if !removed {
println("ok !removed")
// CHECK: ok !removed
}
var selNil: Selector = nil
if selNil == nil {
println("ok selNil == nil")
// CHECK: ok selNil == nil
}
selNil = nil
if selNil == nil {
println("ok selNil == nil")
// CHECK: ok selNil == nil
}