|
1 | 1 | // RUN: %target-run-simple-swift
|
2 |
| -// RUN: %target-build-swift -O %s -o %t/a.out.optimized |
3 |
| -// RUN: %target-codesign %t/a.out.optimized |
4 |
| -// RUN: %target-run %t/a.out.optimized |
| 2 | +// |
| 3 | +// RUN: %target-build-swift -swift-version 5 -O %s -o %t/a.swift5.O.out |
| 4 | +// RUN: %target-codesign %t/a.swift5.O.out |
| 5 | +// RUN: %target-run %t/a.swift5.O.out |
| 6 | +// |
| 7 | +// RUN: %target-build-swift -swift-version 5 -Onone %s -o %t/a.swift5.Onone.out |
| 8 | +// RUN: %target-codesign %t/a.swift5.Onone.out |
| 9 | +// RUN: %target-run %t/a.swift5.Onone.out |
| 10 | +// |
5 | 11 | // REQUIRES: executable_test
|
6 | 12 |
|
7 | 13 | import StdlibUnittest
|
@@ -31,15 +37,31 @@ tupleCastTests.test("Adding/removing labels") {
|
31 | 37 | String(describing: anyToIntPoint((3, 4))))
|
32 | 38 | expectEqual("(x: 5, y: 6)",
|
33 | 39 | String(describing: anyToIntPoint((x: 5, 6))))
|
| 40 | + expectEqual("(x: 5, y: 6)", |
| 41 | + String(describing: anyToIntPoint((5, y: 6)))) |
34 | 42 |
|
35 | 43 | expectEqual("(1, 2)", String(describing: anyToInt2((1, 2))))
|
36 | 44 | expectEqual("(3, 4)", String(describing: anyToInt2((x: 3, y: 4))))
|
37 | 45 | expectEqual("(5, 6)", String(describing: anyToInt2((x: 5, 6))))
|
| 46 | + expectEqual("(7, 8)", String(describing: anyToInt2((7, y: 8)))) |
38 | 47 |
|
39 | 48 | expectEqual("(first: 1, 2, third: 3)",
|
40 | 49 | String(describing: anyToPartlyLabeled((1, 2, 3))))
|
41 | 50 | }
|
42 | 51 |
|
| 52 | +tupleCastTests.test("Label checks on casting") { |
| 53 | + expectTrue((x: 1, y: 2) is (Int, Int)) |
| 54 | + expectTrue((x: 1, y: 2) is (x: Int, Int)) |
| 55 | + expectTrue((x: 1, y: 2) is (Int, y: Int)) |
| 56 | + expectTrue((x: 1, y: 2) is (x: Int, y: Int)) |
| 57 | + |
| 58 | + expectFalse((x: 1, y: 2) is (x: Int, z: Int)) |
| 59 | + expectFalse((x: 1, y: 2) is (a: Int, y: Int)) |
| 60 | + expectFalse((x: 1, y: 2) is (a: Int, z: Int)) |
| 61 | + expectFalse((x: 1, y: 2) is (Int, z: Int)) |
| 62 | + expectFalse((x: 1, y: 2) is (a: Int, Int)) |
| 63 | +} |
| 64 | + |
43 | 65 | tupleCastTests.test("Incorrect labels conditional cast") {
|
44 | 66 | expectNil(anyToIntPointOpt((x: 1, z: 2)))
|
45 | 67 | expectEqual("Optional((x: 1, y: 2))",
|
|
0 commit comments