@@ -50,16 +50,9 @@ static std::vector<std::string> runComp(clang::Interpreter &MainInterp,
50
50
return Comps;
51
51
}
52
52
53
- #ifdef _AIX
54
- TEST (CodeCompletionTest, DISABLED_Sanity) {
55
- #else
56
53
TEST (CodeCompletionTest, Sanity) {
57
- #endif
58
54
auto Interp = createInterpreter ();
59
- if (auto R = Interp->ParseAndExecute (" int foo = 12;" )) {
60
- consumeError (std::move (R));
61
- return ;
62
- }
55
+ cantFail (Interp->Parse (" int foo = 12;" ));
63
56
auto Err = llvm::Error::success ();
64
57
auto comps = runComp (*Interp, " f" , Err);
65
58
EXPECT_EQ ((size_t )2 , comps.size ()); // float and foo
@@ -68,36 +61,19 @@ TEST(CodeCompletionTest, Sanity) {
68
61
EXPECT_EQ ((bool )Err, false );
69
62
}
70
63
71
- #ifdef _AIX
72
- TEST (CodeCompletionTest, DISABLED_SanityNoneValid) {
73
- #else
74
64
TEST (CodeCompletionTest, SanityNoneValid) {
75
- #endif
76
65
auto Interp = createInterpreter ();
77
- if (auto R = Interp->ParseAndExecute (" int foo = 12;" )) {
78
- consumeError (std::move (R));
79
- return ;
80
- }
66
+ cantFail (Interp->Parse (" int foo = 12;" ));
81
67
auto Err = llvm::Error::success ();
82
68
auto comps = runComp (*Interp, " babanana" , Err);
83
69
EXPECT_EQ ((size_t )0 , comps.size ()); // foo and float
84
70
EXPECT_EQ ((bool )Err, false );
85
71
}
86
72
87
- #ifdef _AIX
88
- TEST (CodeCompletionTest, DISABLED_TwoDecls) {
89
- #else
90
73
TEST (CodeCompletionTest, TwoDecls) {
91
- #endif
92
74
auto Interp = createInterpreter ();
93
- if (auto R = Interp->ParseAndExecute (" int application = 12;" )) {
94
- consumeError (std::move (R));
95
- return ;
96
- }
97
- if (auto R = Interp->ParseAndExecute (" int apple = 12;" )) {
98
- consumeError (std::move (R));
99
- return ;
100
- }
75
+ cantFail (Interp->Parse (" int application = 12;" ));
76
+ cantFail (Interp->Parse (" int apple = 12;" ));
101
77
auto Err = llvm::Error::success ();
102
78
auto comps = runComp (*Interp, " app" , Err);
103
79
EXPECT_EQ ((size_t )2 , comps.size ());
@@ -113,29 +89,17 @@ TEST(CodeCompletionTest, CompFunDeclsNoError) {
113
89
114
90
TEST (CodeCompletionTest, TypedDirected) {
115
91
auto Interp = createInterpreter ();
116
- if (auto R = Interp->ParseAndExecute (" int application = 12;" )) {
117
- consumeError (std::move (R));
118
- return ;
119
- }
120
- if (auto R = Interp->ParseAndExecute (" char apple = '2';" )) {
121
- consumeError (std::move (R));
122
- return ;
123
- }
124
- if (auto R = Interp->ParseAndExecute (" void add(int &SomeInt){}" )) {
125
- consumeError (std::move (R));
126
- return ;
127
- }
92
+ cantFail (Interp->Parse (" int application = 12;" ));
93
+ cantFail (Interp->Parse (" char apple = '2';" ));
94
+ cantFail (Interp->Parse (" void add(int &SomeInt){}" ));
128
95
{
129
96
auto Err = llvm::Error::success ();
130
97
auto comps = runComp (*Interp, std::string (" add(" ), Err);
131
98
EXPECT_EQ ((size_t )1 , comps.size ());
132
99
EXPECT_EQ ((bool )Err, false );
133
100
}
134
101
135
- if (auto R = Interp->ParseAndExecute (" int banana = 42;" )) {
136
- consumeError (std::move (R));
137
- return ;
138
- }
102
+ cantFail (Interp->Parse (" int banana = 42;" ));
139
103
140
104
{
141
105
auto Err = llvm::Error::success ();
@@ -157,22 +121,10 @@ TEST(CodeCompletionTest, TypedDirected) {
157
121
158
122
TEST (CodeCompletionTest, SanityClasses) {
159
123
auto Interp = createInterpreter ();
160
- if (auto R = Interp->ParseAndExecute (" struct Apple{};" )) {
161
- consumeError (std::move (R));
162
- return ;
163
- }
164
- if (auto R = Interp->ParseAndExecute (" void takeApple(Apple &a1){}" )) {
165
- consumeError (std::move (R));
166
- return ;
167
- }
168
- if (auto R = Interp->ParseAndExecute (" Apple a1;" )) {
169
- consumeError (std::move (R));
170
- return ;
171
- }
172
- if (auto R = Interp->ParseAndExecute (" void takeAppleCopy(Apple a1){}" )) {
173
- consumeError (std::move (R));
174
- return ;
175
- }
124
+ cantFail (Interp->Parse (" struct Apple{};" ));
125
+ cantFail (Interp->Parse (" void takeApple(Apple &a1){}" ));
126
+ cantFail (Interp->Parse (" Apple a1;" ));
127
+ cantFail (Interp->Parse (" void takeAppleCopy(Apple a1){}" ));
176
128
177
129
{
178
130
auto Err = llvm::Error::success ();
@@ -192,26 +144,11 @@ TEST(CodeCompletionTest, SanityClasses) {
192
144
193
145
TEST (CodeCompletionTest, SubClassing) {
194
146
auto Interp = createInterpreter ();
195
- if (auto R = Interp->ParseAndExecute (" struct Fruit {};" )) {
196
- consumeError (std::move (R));
197
- return ;
198
- }
199
- if (auto R = Interp->ParseAndExecute (" struct Apple : Fruit{};" )) {
200
- consumeError (std::move (R));
201
- return ;
202
- }
203
- if (auto R = Interp->ParseAndExecute (" void takeFruit(Fruit &f){}" )) {
204
- consumeError (std::move (R));
205
- return ;
206
- }
207
- if (auto R = Interp->ParseAndExecute (" Apple a1;" )) {
208
- consumeError (std::move (R));
209
- return ;
210
- }
211
- if (auto R = Interp->ParseAndExecute (" Fruit f1;" )) {
212
- consumeError (std::move (R));
213
- return ;
214
- }
147
+ cantFail (Interp->Parse (" struct Fruit {};" ));
148
+ cantFail (Interp->Parse (" struct Apple : Fruit{};" ));
149
+ cantFail (Interp->Parse (" void takeFruit(Fruit &f){}" ));
150
+ cantFail (Interp->Parse (" Apple a1;" ));
151
+ cantFail (Interp->Parse (" Fruit f1;" ));
215
152
auto Err = llvm::Error::success ();
216
153
auto comps = runComp (*Interp, std::string (" takeFruit(" ), Err);
217
154
EXPECT_EQ ((size_t )2 , comps.size ());
@@ -222,18 +159,9 @@ TEST(CodeCompletionTest, SubClassing) {
222
159
223
160
TEST (CodeCompletionTest, MultipleArguments) {
224
161
auto Interp = createInterpreter ();
225
- if (auto R = Interp->ParseAndExecute (" int foo = 42;" )) {
226
- consumeError (std::move (R));
227
- return ;
228
- }
229
- if (auto R = Interp->ParseAndExecute (" char fowl = 'A';" )) {
230
- consumeError (std::move (R));
231
- return ;
232
- }
233
- if (auto R = Interp->ParseAndExecute (" void takeTwo(int &a, char b){}" )) {
234
- consumeError (std::move (R));
235
- return ;
236
- }
162
+ cantFail (Interp->Parse (" int foo = 42;" ));
163
+ cantFail (Interp->Parse (" char fowl = 'A';" ));
164
+ cantFail (Interp->Parse (" void takeTwo(int &a, char b){}" ));
237
165
auto Err = llvm::Error::success ();
238
166
auto comps = runComp (*Interp, std::string (" takeTwo(foo, " ), Err);
239
167
EXPECT_EQ ((size_t )1 , comps.size ());
@@ -243,9 +171,9 @@ TEST(CodeCompletionTest, MultipleArguments) {
243
171
244
172
TEST (CodeCompletionTest, Methods) {
245
173
auto Interp = createInterpreter ();
246
- cantFail (Interp->ParseAndExecute (
174
+ cantFail (Interp->Parse (
247
175
" struct Foo{int add(int a){return 42;} int par(int b){return 42;}};" ));
248
- cantFail (Interp->ParseAndExecute (" Foo f1;" ));
176
+ cantFail (Interp->Parse (" Foo f1;" ));
249
177
250
178
auto Err = llvm::Error::success ();
251
179
auto comps = runComp (*Interp, std::string (" f1." ), Err);
@@ -257,10 +185,10 @@ TEST(CodeCompletionTest, Methods) {
257
185
258
186
TEST (CodeCompletionTest, MethodsInvocations) {
259
187
auto Interp = createInterpreter ();
260
- cantFail (Interp->ParseAndExecute (
188
+ cantFail (Interp->Parse (
261
189
" struct Foo{int add(int a){return 42;} int par(int b){return 42;}};" ));
262
- cantFail (Interp->ParseAndExecute (" Foo f1;" ));
263
- cantFail (Interp->ParseAndExecute (" int a = 84;" ));
190
+ cantFail (Interp->Parse (" Foo f1;" ));
191
+ cantFail (Interp->Parse (" int a = 84;" ));
264
192
265
193
auto Err = llvm::Error::success ();
266
194
auto comps = runComp (*Interp, std::string (" f1.add(" ), Err);
@@ -271,11 +199,11 @@ TEST(CodeCompletionTest, MethodsInvocations) {
271
199
272
200
TEST (CodeCompletionTest, NestedInvocations) {
273
201
auto Interp = createInterpreter ();
274
- cantFail (Interp->ParseAndExecute (
202
+ cantFail (Interp->Parse (
275
203
" struct Foo{int add(int a){return 42;} int par(int b){return 42;}};" ));
276
- cantFail (Interp->ParseAndExecute (" Foo f1;" ));
277
- cantFail (Interp->ParseAndExecute (" int a = 84;" ));
278
- cantFail (Interp->ParseAndExecute (" int plus(int a, int b) { return a + b; }" ));
204
+ cantFail (Interp->Parse (" Foo f1;" ));
205
+ cantFail (Interp->Parse (" int a = 84;" ));
206
+ cantFail (Interp->Parse (" int plus(int a, int b) { return a + b; }" ));
279
207
280
208
auto Err = llvm::Error::success ();
281
209
auto comps = runComp (*Interp, std::string (" plus(42, f1.add(" ), Err);
@@ -287,8 +215,8 @@ TEST(CodeCompletionTest, NestedInvocations) {
287
215
TEST (CodeCompletionTest, TemplateFunctions) {
288
216
auto Interp = createInterpreter ();
289
217
cantFail (
290
- Interp->ParseAndExecute (" template <typename T> T id(T a) { return a;} " ));
291
- cantFail (Interp->ParseAndExecute (" int apple = 84;" ));
218
+ Interp->Parse (" template <typename T> T id(T a) { return a;} " ));
219
+ cantFail (Interp->Parse (" int apple = 84;" ));
292
220
{
293
221
auto Err = llvm::Error::success ();
294
222
auto comps = runComp (*Interp, std::string (" id<int>(" ), Err);
@@ -297,9 +225,9 @@ TEST(CodeCompletionTest, TemplateFunctions) {
297
225
EXPECT_EQ ((bool )Err, false );
298
226
}
299
227
300
- cantFail (Interp->ParseAndExecute (
228
+ cantFail (Interp->Parse (
301
229
" template <typename T> T pickFirst(T a, T b) { return a;} " ));
302
- cantFail (Interp->ParseAndExecute (" char pear = '4';" ));
230
+ cantFail (Interp->Parse (" char pear = '4';" ));
303
231
{
304
232
auto Err = llvm::Error::success ();
305
233
auto comps = runComp (*Interp, std::string (" pickFirst(apple, " ), Err);
0 commit comments