mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[stdlib-unittest] Added tests for NSSet / NSArray
Swift SVN r23216
This commit is contained in:
35
test/1_stdlib/NSArrayAPI.swift
Normal file
35
test/1_stdlib/NSArrayAPI.swift
Normal file
@@ -0,0 +1,35 @@
|
||||
// RUN: %target-run-simple-swift
|
||||
|
||||
import StdlibUnittest
|
||||
import Foundation
|
||||
|
||||
var NSArrayAPI = TestSuite("NSArrayAPI")
|
||||
|
||||
NSArrayAPI.test("mixed types with AnyObject") {
|
||||
if true {
|
||||
let result: AnyObject = [1, "two"]
|
||||
let expect: NSArray = [1, "two"]
|
||||
expectEqual(expect, result as NSArray)
|
||||
}
|
||||
if true {
|
||||
let result: AnyObject = [1, 2]
|
||||
let expect: NSArray = [1, 2]
|
||||
expectEqual(expect, result as NSArray)
|
||||
}
|
||||
}
|
||||
|
||||
NSArrayAPI.test("Printable") {
|
||||
let result = toString(NSArray(objects:"A", "B", "C", "D"))
|
||||
let expect = "(\n A,\n B,\n C,\n D\n)"
|
||||
expectEqual(expect, result)
|
||||
}
|
||||
|
||||
var NSMutableArrayAPI = TestSuite("NSMutableArrayAPI")
|
||||
|
||||
NSMutableArrayAPI.test("Printable") {
|
||||
let result = toString(NSMutableArray(objects:"A", "B", "C", "D"))
|
||||
let expect = "(\n A,\n B,\n C,\n D\n)"
|
||||
expectEqual(expect, result)
|
||||
}
|
||||
|
||||
runAllTests()
|
||||
Reference in New Issue
Block a user