     ClassPrintable(2), ClassPrintable(3) ] as Array<AnyObject>)
 }
 
-func test_DictionaryPrinting() {
-  var dictSI: Dictionary<String, Int> = [:]
-  printedIs(dictSI, "[:]")
-  debugPrintedIs(dictSI, "[:]")
-
-  dictSI = [ "aaa": 1 ]
-  printedIs(dictSI, "[\"aaa\": 1]")
-  debugPrintedIs(dictSI, "[\"aaa\": 1]")
-
-  dictSI = [ "aaa": 1, "bbb": 2 ]
-  printedIs(dictSI, "[\"aaa\": 1, \"bbb\": 2]", expected2: "[\"bbb\": 2, \"aaa\": 1]")
-  debugPrintedIs(dictSI, "[\"aaa\": 1, \"bbb\": 2]", expected2: "[\"bbb\": 2, \"aaa\": 1]")
-
-  let dictSS = [ "aaa": "bbb" ]
-  printedIs(dictSS, "[\"aaa\": \"bbb\"]")
-  debugPrintedIs(dictSS, "[\"aaa\": \"bbb\"]")
-
-  print("test_DictionaryPrinting done")
-}
-test_DictionaryPrinting()
-// CHECK: test_DictionaryPrinting done
-
-func test_SetPrinting() {
-  var sI = Set<Int>()
-  printedIs(sI, "[]")
-  debugPrintedIs(sI, "Set([])")
-
-  sI = Set<Int>([11, 22])
-  printedIs(sI, "[11, 22]", expected2: "[22, 11]")
-  debugPrintedIs(sI, "Set([11, 22])", expected2: "Set([22, 11])")
-
-  let sS = Set<String>(["Hello", "world"])
-  printedIs(sS, "[\"Hello\", \"world\"]", expected2: "[\"world\", \"Hello\"]")
-  debugPrintedIs(sS, "Set([\"Hello\", \"world\"])", expected2: "Set([\"world\", \"Hello\"])")
-
-  print("test_SetPrinting done")
-}
-test_SetPrinting()
-// CHECK: test_SetPrinting done
-
-func test_TuplePrinting() {
-  let tuple1 = (42, ())
-  printedIs(tuple1, "(42, ())")
-
-  let tuple2 = ((), 42)
-  printedIs(tuple2, "((), 42)")
-
-  let tuple3 = (42, StructPrintable(3))
-  printedIs(tuple3, "(42, ►3◀︎)")
-
-  let tuple4 = (42, LargeStructPrintable(10, 20, 30, 40))
-  printedIs(tuple4, "(42, <10 20 30 40>)")
-
-  let tuple5 = (42, ClassPrintable(3))
-  printedIs(tuple5, "(42, ►3◀︎)")
-
-  let tuple6 = ([123: 123], (1, 2, "3"))
-  printedIs(tuple6, "([123: 123], (1, 2, \"3\"))")
-
-  let arrayOfTuples1 =
-      [ (1, "two", StructPrintable(3), StructDebugPrintable(4),
-         WithoutDescription(5)) ]
-  printedIs(arrayOfTuples1, "[(1, \"two\", ►3◀︎, ►4◀︎, a.WithoutDescription(x: 5))]")
-
-  let arrayOfTuples2 =
-      [ (1, "two", WithoutDescription(3)),
-        (11, "twenty-two", WithoutDescription(33)),
-        (111, "two hundred twenty-two", WithoutDescription(333)) ]
-  printedIs(arrayOfTuples2, "[(1, \"two\", a.WithoutDescription(x: 3)), (11, \"twenty-two\", a.WithoutDescription(x: 33)), (111, \"two hundred twenty-two\", a.WithoutDescription(x: 333))]")
-
-  print("test_TuplePrinting done")
-}
-test_TuplePrinting()
-// CHECK: test_TuplePrinting done
-
-func test_ArbitraryStructPrinting() {
-  let arrayOfArbitraryStructs =
-    [ WithoutDescription(1), WithoutDescription(2), WithoutDescription(3) ]
-  printedIs(
-    arrayOfArbitraryStructs,
-    "[a.WithoutDescription(x: 1), a.WithoutDescription(x: 2), a.WithoutDescription(x: 3)]")
-  debugPrintedIs(
-    arrayOfArbitraryStructs,
-    "[a.WithoutDescription(x: 1), a.WithoutDescription(x: 2), a.WithoutDescription(x: 3)]")
-
-  printedIs(
-    EmptyStructWithoutDescription(),
-    "EmptyStructWithoutDescription()")
-  debugPrintedIs(
-    EmptyStructWithoutDescription(),
-    "a.EmptyStructWithoutDescription()")
-
-  printedIs(
-    ValuesWithoutDescription(1.25, "abc", [ 1, 2, 3 ]),
-    "ValuesWithoutDescription<Double, String, Array<Int>>(t: 1.25, u: \"abc\", v: [1, 2, 3])")
-  debugPrintedIs(
-    ValuesWithoutDescription(1.25, "abc", [ 1, 2, 3 ]),
-    "a.ValuesWithoutDescription<Swift.Double, Swift.String, Swift.Array<Swift.Int>>(t: 1.25, u: \"abc\", v: [1, 2, 3])")
-
-  print("test_ArbitraryStructPrinting done")
-}
-test_ArbitraryStructPrinting()
-// CHECK: test_ArbitraryStructPrinting done
-
-func test_MetatypePrinting() {
-  printedIs(Int.self, "Int")
-  debugPrintedIs(Int.self, "Swift.Int")
-
-  print("test_MetatypePrinting done")
-}
-test_MetatypePrinting()
-// CHECK: test_MetatypePrinting done
-
-func test_StringInterpolation() {
-  assertEquals("1", "\(1)")
-  assertEquals("2", "\(1 + 1)")
-  assertEquals("aaa1bbb2ccc", "aaa\(1)bbb\(2)ccc")
-
-  assertEquals("1.0", "\(1.0)")
-  assertEquals("1.5", "\(1.5)")
-  assertEquals("1e-12", "\(1.0 / (1000000000000))")
-
-  assertEquals("inf", "\(1 / 0.0)")
-  assertEquals("-inf", "\(-1 / 0.0)")
-  assertEquals("nan", "\(0 / 0.0)")
-
-  assertEquals("<[►1◀︎, ►2◀︎, ►3◀︎]>", "<\([ StructPrintable(1), StructPrintable(2), StructPrintable(3) ])>")
-  assertEquals("WithoutDescription(x: 1)", "\(WithoutDescription(1))")
-
-  print("test_StringInterpolation done")
-}
-test_StringInterpolation()
-// CHECK: test_StringInterpolation done
+PrintTests.test("Dictionary") {
+  expectPrinted("[:]", [String: Int]())
+  expectDebugPrinted("[:]", [String: Int]())
+  
+  expectPrinted("[\"aaa\": 1]", [ "aaa": 1 ])
+  expectDebugPrinted("[\"aaa\": 1]", [ "aaa": 1 ])
+  
+  let d0 = [ "aaa": 1, "bbb": 2 ]
+  expectPrinted(expectedOneOf: [ "[\"aaa\": 1, \"bbb\": 2]",
+    "[\"bbb\": 2, \"aaa\": 1]" ], d0)
+  expectDebugPrinted(expectedOneOf: [ "[\"aaa\": 1, \"bbb\": 2]",
+    "[\"bbb\": 2, \"aaa\": 1]" ], d0)
+  
+  let d1 = [ "aaa": "bbb" ]
+  expectPrinted("[\"aaa\": \"bbb\"]", d1)
+  expectDebugPrinted("[\"aaa\": \"bbb\"]", d1)
+}
+
+PrintTests.test("Set") {
+  expectPrinted("[]", Set<Int>())
+  expectDebugPrinted("Set([])", Set<Int>())
+  
+  let s0 = Set<Int>([11, 22])
+  expectPrinted(expectedOneOf: [ "[11, 22]", "[22, 11]" ], s0)
+  expectDebugPrinted(expectedOneOf: [ "Set([11, 22])",
+    "Set([22, 11])" ], s0)
+  
+  let s1 = Set<String>(["Hello", "world"])
+  expectPrinted(expectedOneOf: [ "[\"Hello\", \"world\"]",
+    "[\"world\", \"Hello\"]" ], s1)
+  expectDebugPrinted(expectedOneOf: [ "Set([\"Hello\", \"world\"])",
+    "Set([\"world\", \"Hello\"])" ], s1)
+}
+
+PrintTests.test("Tuple") {
+  expectPrinted("(42, ())", (42, ()))
+  expectPrinted("((), 42)", ((), 42))
+  expectPrinted("(42, ►3◀︎)", (42, StructPrintable(3)))
+  expectPrinted("(42, <10 20 30 40>)",
+    (42, LargeStructPrintable(10, 20, 30, 40)))
+  expectPrinted("(42, ►3◀︎)", (42, ClassPrintable(3)))
+  expectPrinted("([123: 123], (1, 2, \"3\"))",
+    ([123: 123], (1, 2, "3")))
+  
+  let t0 = [ (1, "two", StructPrintable(3), StructDebugPrintable(4),
+    WithoutDescription(5)) ]
+  expectPrinted("[(1, \"two\", ►3◀︎, ►4◀︎, a.WithoutDescription(x: 5))]",
+    t0)
+  
+  let t1 = [ (1, "two", WithoutDescription(3)),
+    (11, "twenty-two", WithoutDescription(33)),
+    (111, "two hundred twenty-two", WithoutDescription(333)) ]
+  expectPrinted("[(1, \"two\", a.WithoutDescription(x: 3)), (11, \"twenty-two\", a.WithoutDescription(x: 33)), (111, \"two hundred twenty-two\", a.WithoutDescription(x: 333))]", t1)
+}
+
+PrintTests.test("ArbitraryStruct") {
+  let s0 = [ WithoutDescription(1), WithoutDescription(2), WithoutDescription(3) ]
+  expectPrinted(
+  "[a.WithoutDescription(x: 1), a.WithoutDescription(x: 2), a.WithoutDescription(x: 3)]",
+  s0)
+  expectDebugPrinted(
+  "[a.WithoutDescription(x: 1), a.WithoutDescription(x: 2), a.WithoutDescription(x: 3)]",
+  s0)
+  
+  expectPrinted("EmptyStructWithoutDescription()",
+    EmptyStructWithoutDescription())
+  expectDebugPrinted("a.EmptyStructWithoutDescription()",
+    EmptyStructWithoutDescription())
+  
+  expectPrinted(
+    "ValuesWithoutDescription<Double, String, Array<Int>>(t: 1.25, u: \"abc\", v: [1, 2, 3])",
+    ValuesWithoutDescription(1.25, "abc", [ 1, 2, 3 ]))
+  expectDebugPrinted(
+    "a.ValuesWithoutDescription<Swift.Double, Swift.String, Swift.Array<Swift.Int>>(t: 1.25, u: \"abc\", v: [1, 2, 3])", ValuesWithoutDescription(1.25, "abc", [ 1, 2, 3 ]))
+}
+
+PrintTests.test("Metatype") {
+  expectPrinted("Int", Int.self)
+  expectDebugPrinted("Swift.Int", Int.self)
+}
+
+PrintTests.test("StringInterpolation") {
+  expectEqual("1", "\(1)")
+  expectEqual("2", "\(1 + 1)")
+  expectEqual("aaa1bbb2ccc", "aaa\(1)bbb\(2)ccc")
+  
+  expectEqual("1.0", "\(1.0)")
+  expectEqual("1.5", "\(1.5)")
+  expectEqual("1e-12", "\(1.0 / (1000000000000))")
+  
+  expectEqual("inf", "\(1 / 0.0)")
+  expectEqual("-inf", "\(-1 / 0.0)")
+  expectEqual("nan", "\(0 / 0.0)")
+  
+  expectEqual("<[►1◀︎, ►2◀︎, ►3◀︎]>", "<\([ StructPrintable(1), StructPrintable(2), StructPrintable(3) ])>")
+  expectEqual("WithoutDescription(x: 1)", "\(WithoutDescription(1))")
+}
 
 struct MyString : StringLiteralConvertible, StringInterpolationConvertible {
   init(str: String) {

// RUN: mkdir -p %t
// RUN: %target-build-swift %s -parse-stdlib -Xfrontend -disable-access-control -o %t/a.out -Xlinker -dead_strip
// RUN: %target-run %t/a.out env | FileCheck %s
// RUN: %target-run %t/a.out ru_RU.UTF-8 | FileCheck %s
// REQUIRES: executable_test

// XFAIL: linux

import Swift
import Darwin

// Interpret the command line arguments.
let arg = Process.arguments[1]

if arg == "env" {
  setlocale(LC_ALL, "")
} else {
  setlocale(LC_ALL, arg)
}

import StdlibUnittest
let PrintTests = TestSuite("Print")

PrintTests.test("stdlib types have description") {
  func hasDescription(any: Any) {

}

PrintTests.test("optional strings") {
  expectPrinted("nil", String!())
  expectPrinted("meow", String!("meow"))
  expectPrinted("nil", String?())
  expectPrinted("Optional(\"meow\")", String?("meow"))
}

PrintTests.test("custom string convertible structs") {
