@@ -143,201 +143,6 @@ fn simple_deps() {
143
143
p. process ( & p. target_bin ( & target, "foo" ) ) . run ( ) ;
144
144
}
145
145
146
- #[ cargo_test]
147
- fn plugin_deps ( ) {
148
- if cross_compile:: disabled ( ) {
149
- return ;
150
- }
151
- if !is_nightly ( ) {
152
- // plugins are unstable
153
- return ;
154
- }
155
-
156
- let foo = project ( )
157
- . file (
158
- "Cargo.toml" ,
159
- r#"
160
- [package]
161
- name = "foo"
162
- version = "0.0.1"
163
- authors = []
164
-
165
- [dependencies.bar]
166
- path = "../bar"
167
-
168
- [dependencies.baz]
169
- path = "../baz"
170
- "# ,
171
- )
172
- . file (
173
- "src/main.rs" ,
174
- r#"
175
- #![feature(plugin)]
176
- #![plugin(bar)]
177
- extern crate baz;
178
- fn main() {
179
- assert_eq!(bar!(), baz::baz());
180
- }
181
- "# ,
182
- )
183
- . build ( ) ;
184
- let _bar = project ( )
185
- . at ( "bar" )
186
- . file (
187
- "Cargo.toml" ,
188
- r#"
189
- [package]
190
- name = "bar"
191
- version = "0.0.1"
192
- authors = []
193
-
194
- [lib]
195
- name = "bar"
196
- plugin = true
197
- "# ,
198
- )
199
- . file (
200
- "src/lib.rs" ,
201
- r#"
202
- #![feature(plugin_registrar, rustc_private)]
203
-
204
- extern crate rustc_driver;
205
- extern crate syntax;
206
- extern crate syntax_expand;
207
-
208
- use rustc_driver::plugin::Registry;
209
- use syntax::tokenstream::TokenStream;
210
- use syntax::source_map::Span;
211
- use syntax::ast::*;
212
- use syntax_expand::base::{ExtCtxt, MacEager, MacResult};
213
-
214
- #[plugin_registrar]
215
- pub fn foo(reg: &mut Registry) {
216
- reg.register_macro("bar", expand_bar);
217
- }
218
-
219
- fn expand_bar(cx: &mut ExtCtxt, sp: Span, tts: TokenStream)
220
- -> Box<MacResult + 'static> {
221
- MacEager::expr(cx.expr_lit(sp, LitKind::Int(1, LitIntType::Unsuffixed)))
222
- }
223
- "# ,
224
- )
225
- . build ( ) ;
226
- let _baz = project ( )
227
- . at ( "baz" )
228
- . file ( "Cargo.toml" , & basic_manifest ( "baz" , "0.0.1" ) )
229
- . file ( "src/lib.rs" , "pub fn baz() -> i32 { 1 }" )
230
- . build ( ) ;
231
-
232
- let target = cross_compile:: alternate ( ) ;
233
- foo. cargo ( "build --target" ) . arg ( & target) . run ( ) ;
234
- assert ! ( foo. target_bin( & target, "foo" ) . is_file( ) ) ;
235
-
236
- foo. process ( & foo. target_bin ( & target, "foo" ) ) . run ( ) ;
237
- }
238
-
239
- #[ cargo_test]
240
- fn plugin_to_the_max ( ) {
241
- if cross_compile:: disabled ( ) {
242
- return ;
243
- }
244
- if !is_nightly ( ) {
245
- // plugins are unstable
246
- return ;
247
- }
248
-
249
- let foo = project ( )
250
- . file (
251
- "Cargo.toml" ,
252
- r#"
253
- [package]
254
- name = "foo"
255
- version = "0.0.1"
256
- authors = []
257
-
258
- [dependencies.bar]
259
- path = "../bar"
260
-
261
- [dependencies.baz]
262
- path = "../baz"
263
- "# ,
264
- )
265
- . file (
266
- "src/main.rs" ,
267
- r#"
268
- #![feature(plugin)]
269
- #![plugin(bar)]
270
- extern crate baz;
271
- fn main() {
272
- assert_eq!(bar!(), baz::baz());
273
- }
274
- "# ,
275
- )
276
- . build ( ) ;
277
- let _bar = project ( )
278
- . at ( "bar" )
279
- . file (
280
- "Cargo.toml" ,
281
- r#"
282
- [package]
283
- name = "bar"
284
- version = "0.0.1"
285
- authors = []
286
-
287
- [lib]
288
- name = "bar"
289
- plugin = true
290
-
291
- [dependencies.baz]
292
- path = "../baz"
293
- "# ,
294
- )
295
- . file (
296
- "src/lib.rs" ,
297
- r#"
298
- #![feature(plugin_registrar, rustc_private)]
299
-
300
- extern crate rustc_driver;
301
- extern crate syntax;
302
- extern crate syntax_expand;
303
- extern crate baz;
304
-
305
- use rustc_driver::plugin::Registry;
306
- use syntax::tokenstream::TokenStream;
307
- use syntax::source_map::Span;
308
- use syntax::ast::*;
309
- use syntax_expand::base::{ExtCtxt, MacEager, MacResult};
310
- use syntax::ptr::P;
311
-
312
- #[plugin_registrar]
313
- pub fn foo(reg: &mut Registry) {
314
- reg.register_macro("bar", expand_bar);
315
- }
316
-
317
- fn expand_bar(cx: &mut ExtCtxt, sp: Span, tts: TokenStream)
318
- -> Box<MacResult + 'static> {
319
- let bar = Ident::from_str("baz");
320
- let path = cx.path(sp, vec![bar.clone(), bar]);
321
- MacEager::expr(cx.expr_call(sp, cx.expr_path(path), vec![]))
322
- }
323
- "# ,
324
- )
325
- . build ( ) ;
326
- let _baz = project ( )
327
- . at ( "baz" )
328
- . file ( "Cargo.toml" , & basic_manifest ( "baz" , "0.0.1" ) )
329
- . file ( "src/lib.rs" , "pub fn baz() -> i32 { 1 }" )
330
- . build ( ) ;
331
-
332
- let target = cross_compile:: alternate ( ) ;
333
- foo. cargo ( "build -v --target" ) . arg ( & target) . run ( ) ;
334
- println ! ( "second" ) ;
335
- foo. cargo ( "build -v --target" ) . arg ( & target) . run ( ) ;
336
- assert ! ( foo. target_bin( & target, "foo" ) . is_file( ) ) ;
337
-
338
- foo. process ( & foo. target_bin ( & target, "foo" ) ) . run ( ) ;
339
- }
340
-
341
146
#[ cargo_test]
342
147
fn linker_and_ar ( ) {
343
148
if cross_compile:: disabled ( ) {
0 commit comments