Skip to content

Commit b7be4f2

Browse files
authored
Auto merge of #3299 - alexcrichton:fix-tests, r=alexcrichton
Fix tests on nightly
2 parents 2ffc035 + 0a78e43 commit b7be4f2

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

src/rustversion.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2016-11-03
1+
2016-11-16

tests/cargotest/support/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,13 @@ impl<T, E: fmt::Display> ErrMsg<T> for Result<T, E> {
235235
// Path to cargo executables
236236
pub fn cargo_dir() -> PathBuf {
237237
env::var_os("CARGO_BIN_PATH").map(PathBuf::from).or_else(|| {
238-
env::current_exe().ok().as_ref().and_then(|s| s.parent())
239-
.map(|s| s.to_path_buf())
238+
env::current_exe().ok().map(|mut path| {
239+
path.pop();
240+
if path.ends_with("deps") {
241+
path.pop();
242+
}
243+
path
244+
})
240245
}).unwrap_or_else(|| {
241246
panic!("CARGO_BIN_PATH wasn't set. Cannot continue running test")
242247
})

tests/proc-macro.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ fn noop() {
4949
use proc_macro::TokenStream;
5050
5151
#[proc_macro_derive(Noop)]
52-
pub fn noop(input: TokenStream) -> TokenStream {
53-
input
52+
pub fn noop(_input: TokenStream) -> TokenStream {
53+
"".parse().unwrap()
5454
}
5555
"#);
5656
noop.build();
@@ -87,8 +87,8 @@ fn impl_and_derive() {
8787
fn impl_by_transmogrify(&self) -> bool;
8888
}
8989
90-
#[derive(Transmogrify)]
91-
struct X;
90+
#[derive(Transmogrify, Debug)]
91+
struct X { success: bool }
9292
9393
fn main() {
9494
let x = X::new();
@@ -115,8 +115,6 @@ fn impl_and_derive() {
115115
#[proc_macro_derive(Transmogrify)]
116116
#[doc(hidden)]
117117
pub fn transmogrify(input: TokenStream) -> TokenStream {
118-
assert_eq!(input.to_string(), "struct X;\n");
119-
120118
"
121119
impl X {
122120
fn new() -> Self {
@@ -129,11 +127,6 @@ fn impl_and_derive() {
129127
true
130128
}
131129
}
132-
133-
#[derive(Debug)]
134-
struct X {
135-
success: bool,
136-
}
137130
".parse().unwrap()
138131
}
139132
"#);

0 commit comments

Comments
 (0)