-
Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathclass-template-variadic.swift
40 lines (31 loc) · 1.06 KB
/
class-template-variadic.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop)
//
// REQUIRES: executable_test
import ClassTemplateVariadic
import StdlibUnittest
var TemplatesTestSuite = TestSuite("TemplatesTestSuite")
TemplatesTestSuite.test("typedeffed-variadic-class-template") {
let a = IntWrapper(value: 10)
let b = IntWrapper(value: 20)
var pair = Pair()
pair.set(a, b)
var pairA = pair.first()
var restB = pair.rest()
var pairB = restB.first()
expectEqual(pairA.getValue(), 10)
expectEqual(pairB.getValue(), 20)
}
// TODO: This test doesn't work because Swift sees this as passing in too many
// generic arguments (https://github.com/apple/swift/issues/55701).
// TemplatesTestSuite.test("variadic-class-template") {
// let a = IntWrapper(value: 10)
// let b = IntWrapper(value: 20)
// var pair = Tuple<IntWrapper, IntWrapper>()
// pair.set(a, b)
// var pairA = pair.first()
// var restB = pair.rest()
// var pairB = restB.first()
// expectEqual(pairA.getValue(), 10)
// expectEqual(pairB.getValue(), 20)
// }
runAllTests()