Add [Any].flatten() .

This commit is contained in:
Kare Morstol
2015-09-20 20:12:42 +02:00
parent d6055c6062
commit 3f09e7498d
5 changed files with 82 additions and 4 deletions
+24
View File
@@ -0,0 +1,24 @@
//
// Array_Tests.swift
// SwiftShell2
//
// Created by Kåre Morstøl on 20.09.15.
//
//
import XCTest
@testable import SwiftShell
class Array_Tests: XCTestCase {
// comparing as strings because XCTAssertEqual doesn't support [Any]
func testAnyArrayFlattenAFlatOne () {
XCTAssertEqual( ([1,"2"] as [Any]).flatten().description, "[1, \"2\"]")
}
func testAnyArrayFlattenABumpyOne () {
XCTAssertEqual( (["1",[2,3]] as [Any]).flatten().description, "[\"1\", 2, 3]")
}
}