Skip to content

Commit 96de2b0

Browse files
committed
auto merge of #6383 : huonw/rust/rustc-expand-then-strip, r=thestinger
This allows macros to create tests and benchmarks. This is possibly unsound (I've got no idea, but it seemed to work), and being able to programmatically generate benchmarks to compare several implementations of similar algorithms is nice.
2 parents 18a47f9 + 9b30fa3 commit 96de2b0

File tree

4 files changed

+7
-16
lines changed

4 files changed

+7
-16
lines changed

src/librustc/driver/driver.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,16 @@ pub fn compile_rest(sess: Session,
182182
*sess.building_library = session::building_library(
183183
sess.opts.crate_type, crate, sess.opts.test);
184184

185+
crate = time(time_passes, ~"expansion", ||
186+
syntax::ext::expand::expand_crate(sess.parse_sess, copy cfg,
187+
crate));
188+
185189
crate = time(time_passes, ~"configuration", ||
186190
front::config::strip_unconfigured_items(crate));
187191

188192
crate = time(time_passes, ~"maybe building test harness", ||
189193
front::test::modify_for_testing(sess, crate));
190194

191-
crate = time(time_passes, ~"expansion", ||
192-
syntax::ext::expand::expand_crate(sess.parse_sess, copy cfg,
193-
crate));
194-
195195
if upto == cu_expand { return (crate, None); }
196196

197197
crate = time(time_passes, ~"intrinsic injection", ||

src/test/run-pass/issue-2904.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ mod test {
7979
pub fn trivial_to_str() {
8080
assert!(lambda.to_str() == "\\")
8181
}
82-
83-
#[test]
84-
pub fn read_simple_board() {
85-
let s = include_str!("./maps/contest1.map");
86-
io::with_str_reader(s, read_board_grid)
87-
}
8882
}
8983

9084
pub fn main() {}

src/test/run-pass/issue-3424.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ use core::path::{Path};
1616

1717
type rsrc_loader = ~fn(path: &Path) -> result::Result<~str, ~str>;
1818

19-
#[test]
2019
fn tester()
2120
{
2221
let loader: rsrc_loader = |_path| {result::Ok(~"more blah")};
2322

24-
let path = path::from_str("blah");
23+
let path = path::Path("blah");
2524
assert!(loader(&path).is_ok());
2625
}
2726

src/test/run-pass/issue-3559.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// xfail-fast
1+
// xfail-test #4276
22

33
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
44
// file at the top-level directory of this distribution and at
@@ -15,7 +15,6 @@ extern mod std;
1515

1616
use core::io::{WriterUtil};
1717

18-
#[cfg(test)]
1918
fn check_strs(actual: &str, expected: &str) -> bool
2019
{
2120
if actual != expected
@@ -26,10 +25,9 @@ fn check_strs(actual: &str, expected: &str) -> bool
2625
return true;
2726
}
2827

29-
#[test]
3028
fn tester()
3129
{
32-
let mut table = core::hashmap::HashMap();
30+
let mut table = core::hashmap::HashMap::new();
3331
table.insert(@~"one", 1);
3432
table.insert(@~"two", 2);
3533
assert!(check_strs(table.to_str(), ~"xxx")); // not sure what expected should be

0 commit comments

Comments
 (0)