Skip to content

Commit ceb1ba7

Browse files
committed
Rewrite part swiftlang#5 of file with StdlibUnittest
1 parent 967a5ef commit ceb1ba7

File tree

1 file changed

+22
-32
lines changed

1 file changed

+22
-32
lines changed

Diff for: test/1_stdlib/Print.swift

+22-32
Original file line numberDiff line numberDiff line change
@@ -675,39 +675,29 @@ PrintTests.test("ClassVeryPrintable") {
675675
expectPrinted("<description: 1>", c4)
676676
}
677677

678-
func test_ArrayPrinting() {
679-
let arrayOfInts: [Int] = []
680-
printedIs(arrayOfInts, "[]")
681-
682-
printedIs([ 1 ], "[1]")
683-
printedIs([ 1, 2 ], "[1, 2]")
684-
printedIs([ 1, 2, 3 ], "[1, 2, 3]")
685-
686-
printedIs([ "foo", "bar", "bas" ], "[\"foo\", \"bar\", \"bas\"]")
687-
debugPrintedIs([ "foo", "bar", "bas" ], "[\"foo\", \"bar\", \"bas\"]")
688-
689-
printedIs([ StructPrintable(1), StructPrintable(2),
690-
StructPrintable(3) ],
691-
"[►1◀︎, ►2◀︎, ►3◀︎]")
692-
693-
printedIs([ LargeStructPrintable(10, 20, 30, 40),
694-
LargeStructPrintable(50, 60, 70, 80) ],
695-
"[<10 20 30 40>, <50 60 70 80>]")
696-
697-
printedIs([ StructDebugPrintable(1) ], "[►1◀︎]")
698-
699-
printedIs([ ClassPrintable(1), ClassPrintable(2),
700-
ClassPrintable(3) ],
701-
"[►1◀︎, ►2◀︎, ►3◀︎]")
702-
703-
printedIs([ ClassPrintable(1), ClassPrintable(2),
704-
ClassPrintable(3) ] as Array<AnyObject>,
705-
"[►1◀︎, ►2◀︎, ►3◀︎]")
706-
707-
print("test_ArrayPrinting done")
678+
PrintTests.test("Array") {
679+
expectPrinted("[]", [Int]())
680+
expectPrinted("[1]", [ 1 ])
681+
expectPrinted("[1, 2]", [ 1, 2 ])
682+
expectPrinted("[1, 2, 3]", [ 1, 2, 3 ])
683+
684+
expectPrinted("[\"foo\", \"bar\", \"bas\"]", [ "foo", "bar", "bas" ])
685+
expectDebugPrinted("[\"foo\", \"bar\", \"bas\"]", [ "foo", "bar", "bas" ])
686+
687+
expectPrinted("[►1◀︎, ►2◀︎, ►3◀︎]", [ StructPrintable(1),
688+
StructPrintable(2), StructPrintable(3) ])
689+
690+
expectPrinted("[<10 20 30 40>, <50 60 70 80>]",
691+
[ LargeStructPrintable(10, 20, 30, 40), LargeStructPrintable(50, 60, 70, 80) ])
692+
693+
expectPrinted("[►1◀︎]", [ StructDebugPrintable(1) ])
694+
695+
expectPrinted("[►1◀︎, ►2◀︎, ►3◀︎]", [ ClassPrintable(1),
696+
ClassPrintable(2), ClassPrintable(3) ])
697+
698+
expectPrinted("[►1◀︎, ►2◀︎, ►3◀︎]", [ ClassPrintable(1),
699+
ClassPrintable(2), ClassPrintable(3) ] as Array<AnyObject>)
708700
}
709-
test_ArrayPrinting()
710-
// CHECK: test_ArrayPrinting done
711701

712702
func test_DictionaryPrinting() {
713703
var dictSI: Dictionary<String, Int> = [:]

0 commit comments

Comments
 (0)