mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stdlib] Added NSEnumerator to SequenceType
Fixes rdar://problem/17925006 Swift SVN r23497
This commit is contained in:
25
test/1_stdlib/NSEnumeratorAPI.swift
Normal file
25
test/1_stdlib/NSEnumeratorAPI.swift
Normal file
@@ -0,0 +1,25 @@
|
||||
// RUN: %target-run-simple-swift
|
||||
|
||||
import StdlibUnittest
|
||||
import Foundation
|
||||
|
||||
var NSEnumeratorAPI = TestSuite("NSEnumeratorAPI")
|
||||
|
||||
NSEnumeratorAPI.test("SequenceType") {
|
||||
let result = NSDictionary().keyEnumerator()
|
||||
isSequenceType(result)
|
||||
}
|
||||
|
||||
NSEnumeratorAPI.test("keyEnumerator") {
|
||||
let result = [1: "one", 2: "two"]
|
||||
expectEqualsUnordered(
|
||||
[1, 2], NSDictionary(dictionary: result).keyEnumerator()) {
|
||||
switch ($0 as Int, $1 as Int) {
|
||||
case let (x, y) where x == y: return .EQ
|
||||
case let (x, y) where x < y: return .LT
|
||||
case _: return .GT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
runAllTests()
|
||||
Reference in New Issue
Block a user