1+ //===--- MirrorWithPacks.swift -----------------------------------------------------===//
2+ //
3+ // This source file is part of the Swift.org open source project
4+ //
5+ // Copyright (c) 2023 Apple Inc. and the Swift project authors
6+ // Licensed under Apache License v2.0 with Runtime Library Exception
7+ //
8+ // See https://swift.org/LICENSE.txt for license information
9+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+ //
11+ //===----------------------------------------------------------------------===//
12+ // RUN: %empty-directory(%t)
13+ // RUN: cp %s %t/main.swift
14+ // RUN: %target-build-swift %t/main.swift -o %t/Mirror -Xfrontend -disable-availability-checking
15+ // RUN: %target-codesign %t/Mirror
16+ // RUN: %target-run %t/Mirror
17+
18+ // REQUIRES: executable_test
19+ // REQUIRES: shell
20+ // REQUIRES: reflection
21+
22+ // rdar://96439408
23+ // UNSUPPORTED: use_os_stdlib
24+
25+ import StdlibUnittest
26+
27+ var mirrors = TestSuite ( " MirrorWithPacks " )
28+
29+ struct Tuple < each T > {
30+ var elements : ( repeat each T )
31+ init ( _ elements: repeat each T ) {
32+ self . elements = ( repeat each elements)
33+ }
34+ }
35+
36+ mirrors. test ( " Packs " ) {
37+ let value = Tuple ( " hi " , 3 , false )
38+ var output = " "
39+ dump ( value, to: & output)
40+
41+ let expected =
42+ " ▿ Mirror.Tuple<Pack{Swift.String, Swift.Int, Swift.Bool}> \n " +
43+ " ▿ elements: (3 elements) \n " +
44+ " - .0: \" hi \" \n " +
45+ " - .1: 3 \n " +
46+ " - .2: false \n "
47+
48+ expectEqual ( expected, output)
49+ }
50+
51+ runAllTests ( )
0 commit comments