mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Remove failing plugin tests.
This commit is contained in:
parent
750cb1482e
commit
1d1b035a89
@ -143,201 +143,6 @@ fn simple_deps() {
|
||||
p.process(&p.target_bin(&target, "foo")).run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn plugin_deps() {
|
||||
if cross_compile::disabled() {
|
||||
return;
|
||||
}
|
||||
if !is_nightly() {
|
||||
// plugins are unstable
|
||||
return;
|
||||
}
|
||||
|
||||
let foo = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
authors = []
|
||||
|
||||
[dependencies.bar]
|
||||
path = "../bar"
|
||||
|
||||
[dependencies.baz]
|
||||
path = "../baz"
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
"src/main.rs",
|
||||
r#"
|
||||
#![feature(plugin)]
|
||||
#![plugin(bar)]
|
||||
extern crate baz;
|
||||
fn main() {
|
||||
assert_eq!(bar!(), baz::baz());
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.build();
|
||||
let _bar = project()
|
||||
.at("bar")
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "bar"
|
||||
version = "0.0.1"
|
||||
authors = []
|
||||
|
||||
[lib]
|
||||
name = "bar"
|
||||
plugin = true
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
"src/lib.rs",
|
||||
r#"
|
||||
#![feature(plugin_registrar, rustc_private)]
|
||||
|
||||
extern crate rustc_driver;
|
||||
extern crate syntax;
|
||||
extern crate syntax_expand;
|
||||
|
||||
use rustc_driver::plugin::Registry;
|
||||
use syntax::tokenstream::TokenStream;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::ast::*;
|
||||
use syntax_expand::base::{ExtCtxt, MacEager, MacResult};
|
||||
|
||||
#[plugin_registrar]
|
||||
pub fn foo(reg: &mut Registry) {
|
||||
reg.register_macro("bar", expand_bar);
|
||||
}
|
||||
|
||||
fn expand_bar(cx: &mut ExtCtxt, sp: Span, tts: TokenStream)
|
||||
-> Box<MacResult + 'static> {
|
||||
MacEager::expr(cx.expr_lit(sp, LitKind::Int(1, LitIntType::Unsuffixed)))
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.build();
|
||||
let _baz = project()
|
||||
.at("baz")
|
||||
.file("Cargo.toml", &basic_manifest("baz", "0.0.1"))
|
||||
.file("src/lib.rs", "pub fn baz() -> i32 { 1 }")
|
||||
.build();
|
||||
|
||||
let target = cross_compile::alternate();
|
||||
foo.cargo("build --target").arg(&target).run();
|
||||
assert!(foo.target_bin(&target, "foo").is_file());
|
||||
|
||||
foo.process(&foo.target_bin(&target, "foo")).run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn plugin_to_the_max() {
|
||||
if cross_compile::disabled() {
|
||||
return;
|
||||
}
|
||||
if !is_nightly() {
|
||||
// plugins are unstable
|
||||
return;
|
||||
}
|
||||
|
||||
let foo = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
authors = []
|
||||
|
||||
[dependencies.bar]
|
||||
path = "../bar"
|
||||
|
||||
[dependencies.baz]
|
||||
path = "../baz"
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
"src/main.rs",
|
||||
r#"
|
||||
#![feature(plugin)]
|
||||
#![plugin(bar)]
|
||||
extern crate baz;
|
||||
fn main() {
|
||||
assert_eq!(bar!(), baz::baz());
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.build();
|
||||
let _bar = project()
|
||||
.at("bar")
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "bar"
|
||||
version = "0.0.1"
|
||||
authors = []
|
||||
|
||||
[lib]
|
||||
name = "bar"
|
||||
plugin = true
|
||||
|
||||
[dependencies.baz]
|
||||
path = "../baz"
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
"src/lib.rs",
|
||||
r#"
|
||||
#![feature(plugin_registrar, rustc_private)]
|
||||
|
||||
extern crate rustc_driver;
|
||||
extern crate syntax;
|
||||
extern crate syntax_expand;
|
||||
extern crate baz;
|
||||
|
||||
use rustc_driver::plugin::Registry;
|
||||
use syntax::tokenstream::TokenStream;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::ast::*;
|
||||
use syntax_expand::base::{ExtCtxt, MacEager, MacResult};
|
||||
use syntax::ptr::P;
|
||||
|
||||
#[plugin_registrar]
|
||||
pub fn foo(reg: &mut Registry) {
|
||||
reg.register_macro("bar", expand_bar);
|
||||
}
|
||||
|
||||
fn expand_bar(cx: &mut ExtCtxt, sp: Span, tts: TokenStream)
|
||||
-> Box<MacResult + 'static> {
|
||||
let bar = Ident::from_str("baz");
|
||||
let path = cx.path(sp, vec![bar.clone(), bar]);
|
||||
MacEager::expr(cx.expr_call(sp, cx.expr_path(path), vec![]))
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.build();
|
||||
let _baz = project()
|
||||
.at("baz")
|
||||
.file("Cargo.toml", &basic_manifest("baz", "0.0.1"))
|
||||
.file("src/lib.rs", "pub fn baz() -> i32 { 1 }")
|
||||
.build();
|
||||
|
||||
let target = cross_compile::alternate();
|
||||
foo.cargo("build -v --target").arg(&target).run();
|
||||
println!("second");
|
||||
foo.cargo("build -v --target").arg(&target).run();
|
||||
assert!(foo.target_bin(&target, "foo").is_file());
|
||||
|
||||
foo.process(&foo.target_bin(&target, "foo")).run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn linker_and_ar() {
|
||||
if cross_compile::disabled() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user