Skip to content

Commit 555f96a

Browse files
committed
Fix templat-template-parameter test
1 parent 02201eb commit 555f96a

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
#ifndef TEST_INTEROP_CXX_TEMPLATES_INPUTS_TEMPLATE_TEMPLATE_PARAMETER_H
22
#define TEST_INTEROP_CXX_TEMPLATES_INPUTS_TEMPLATE_TEMPLATE_PARAMETER_H
33

4-
template<template <class> class V>
5-
struct Asdf {
6-
V<IntWrapper> i;
7-
};
8-
94
struct IntWrapper {
105
int value;
116
int getValue() const { return value; }
127
};
138

14-
template <class T>
9+
template<class T>
1510
struct MagicWrapper {
1611
T t;
1712
int getValuePlusArg(int arg) const { return t.getValue() + arg; }
1813
};
1914

20-
typedef Asdf<MagicWrapper> Hohoho;
15+
template<template <class> class V>
16+
struct TemplatedMagicWrapper {
17+
V<IntWrapper> i;
18+
int getValuePlusTwiceTheArg(int arg) const { return i.getValuePlusArg(arg) + arg; }
19+
};
20+
21+
typedef TemplatedMagicWrapper<MagicWrapper> TemplatedWrappedMagicInt;
22+
typedef MagicWrapper<IntWrapper> WrappedMagicInt;
2123
#endif // TEST_INTEROP_CXX_TEMPLATES_INPUTS_TEMPLATE_TEMPLATE_PARAMETER_H

test/Interop/Cxx/templates/template-template-parameter.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
//
33
// REQUIRES: executable_test
44

5-
import NonTypeParameter
5+
import TemplateTemplateParameter
66
import StdlibUnittest
77

88
var TemplatesTestSuite = TestSuite("TemplatesTestSuite")
99

1010
TemplatesTestSuite.test("variadic-class-template") {
11-
let a = IntWrapper(value: 42)
12-
let hohoho = Hohoho()
13-
hohoho.i = a
11+
let myInt = IntWrapper(value: 42)
12+
var magicInt = WrappedMagicInt(t: myInt)
13+
var templatedWrappedMagicInt = TemplatedWrappedMagicInt(i: magicInt)
14+
expectEqual(templatedWrappedMagicInt.getValuePlusTwiceTheArg(10), 62)
1415
}
1516

16-
runAllTests()
17+
runAllTests()

0 commit comments

Comments
 (0)