|
27 | 27 | // REQUIRES: reflection
|
28 | 28 |
|
29 | 29 | // rdar://96439408
|
| 30 | +// UNSUPPORTED: back_deployment_runtime |
30 | 31 | // UNSUPPORTED: use_os_stdlib
|
31 | 32 |
|
32 | 33 | import StdlibUnittest
|
@@ -1669,6 +1670,48 @@ mirrors.test("MetatypeMirror") {
|
1669 | 1670 | }
|
1670 | 1671 | }
|
1671 | 1672 |
|
| 1673 | +class MetatypeExampleClass {} |
| 1674 | +class MetatypeExampleSubclass: MetatypeExampleClass {} |
| 1675 | +final class MetatypeExampleFinalClass {} |
| 1676 | +enum MetatypeExampleEnum {} |
| 1677 | +struct MetatypeContainer { |
| 1678 | + var before = 42 |
| 1679 | + var before2 = 43 |
| 1680 | + var structType = String.self |
| 1681 | + var enumType = MetatypeExampleEnum.self |
| 1682 | + var tupleType = (Int, String, AnyObject).self |
| 1683 | + var functionType = (() -> Void).self |
| 1684 | + var classType = MetatypeExampleClass.self |
| 1685 | + var subclassType: MetatypeExampleClass.Type = MetatypeExampleSubclass.self |
| 1686 | + var finalClassType = MetatypeExampleFinalClass.self |
| 1687 | + var existentialType: (any Any).Type = Any.self |
| 1688 | + var existentialType2: Any.Type = Any.self |
| 1689 | + var after = 45 |
| 1690 | +} |
| 1691 | + |
| 1692 | +mirrors.test("MetatypeFields") { |
| 1693 | + var output = "" |
| 1694 | + let container = MetatypeContainer() |
| 1695 | + dump(container, to: &output) |
| 1696 | + expectEqual(""" |
| 1697 | + ▿ Mirror.MetatypeContainer |
| 1698 | + - before: 42 |
| 1699 | + - before2: 43 |
| 1700 | + - structType: Swift.String #0 |
| 1701 | + - enumType: Mirror.MetatypeExampleEnum #1 |
| 1702 | + - tupleType: (Swift.Int, Swift.String, Swift.AnyObject) #2 |
| 1703 | + - functionType: () -> () #3 |
| 1704 | + - classType: Mirror.MetatypeExampleClass #4 |
| 1705 | + - subclassType: Mirror.MetatypeExampleSubclass #5 |
| 1706 | + - finalClassType: Mirror.MetatypeExampleFinalClass #6 |
| 1707 | + - existentialType: Any #7 |
| 1708 | + - existentialType2: Any #7 |
| 1709 | + - after: 45 |
| 1710 | +
|
| 1711 | + """, |
| 1712 | + output) |
| 1713 | +} |
| 1714 | + |
1672 | 1715 | //===--- Tuples -----------------------------------------------------------===//
|
1673 | 1716 | //===----------------------------------------------------------------------===//
|
1674 | 1717 |
|
|
0 commit comments