Skip to content

Commit 93499b1

Browse files
committed
libtest: Remove all uses of ~str from libtest.
1 parent 1440e09 commit 93499b1

File tree

6 files changed

+138
-99
lines changed

6 files changed

+138
-99
lines changed

src/compiletest/compiletest.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ pub fn parse_config(args: Vec<~str> ) -> Config {
152152
"(none)" != opt_str2(matches.opt_str("adb-test-dir")) &&
153153
!opt_str2(matches.opt_str("adb-test-dir")).is_empty(),
154154
lldb_python_dir: matches.opt_str("lldb-python-dir"),
155-
test_shard: test::opt_shard(matches.opt_str("test-shard")),
155+
test_shard: test::opt_shard(matches.opt_str("test-shard")
156+
.map(|x| x.to_strbuf())),
156157
verbose: matches.opt_present("verbose")
157158
}
158159
}
@@ -235,7 +236,10 @@ pub fn run_tests(config: &Config) {
235236

236237
pub fn test_opts(config: &Config) -> test::TestOpts {
237238
test::TestOpts {
238-
filter: config.filter.clone(),
239+
filter: match config.filter {
240+
None => None,
241+
Some(ref filter) => Some(filter.to_strbuf()),
242+
},
239243
run_ignored: config.run_ignored,
240244
logfile: config.logfile.clone(),
241245
run_tests: true,
@@ -314,7 +318,9 @@ pub fn make_test_name(config: &Config, testfile: &Path) -> test::TestName {
314318
format!("{}/{}", dir.unwrap_or(""), filename.unwrap_or(""))
315319
}
316320

317-
test::DynTestName(format!("[{}] {}", config.mode, shorten(testfile)))
321+
test::DynTestName(format_strbuf!("[{}] {}",
322+
config.mode,
323+
shorten(testfile)))
318324
}
319325

320326
pub fn make_test_closure(config: &Config, testfile: &Path) -> test::TestFn {

src/librustc/front/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::Item {
327327
pub fn main() {
328328
#![main]
329329
use std::slice::Vector;
330-
test::test_main_static(::std::os::args().as_slice(), TESTS);
330+
test::test_main_static_x(::std::os::args().as_slice(), TESTS);
331331
}
332332
)).unwrap();
333333

src/librustdoc/markdown.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,6 @@ pub fn test(input: &str, libs: HashSet<Path>, mut test_args: Vec<StrBuf>) -> int
176176
let mut collector = Collector::new(input.to_strbuf(), libs, true, true);
177177
find_testable_code(input_str.as_slice(), &mut collector);
178178
test_args.unshift("rustdoctest".to_strbuf());
179-
testing::test_main(test_args.move_iter()
180-
.map(|x| x.to_str())
181-
.collect::<Vec<_>>()
182-
.as_slice(),
183-
collector.tests);
179+
testing::test_main(test_args.as_slice(), collector.tests);
184180
0
185181
}

src/librustdoc/test.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,7 @@ pub fn run(input: &str,
9292

9393
test_args.unshift("rustdoctest".to_strbuf());
9494

95-
testing::test_main(test_args.move_iter()
96-
.map(|x| x.to_str())
97-
.collect::<Vec<_>>()
98-
.as_slice(),
95+
testing::test_main(test_args.as_slice(),
9996
collector.tests.move_iter().collect());
10097
0
10198
}
@@ -235,9 +232,9 @@ impl Collector {
235232
pub fn add_test(&mut self, test: StrBuf, should_fail: bool, no_run: bool, should_ignore: bool) {
236233
let name = if self.use_headers {
237234
let s = self.current_header.as_ref().map(|s| s.as_slice()).unwrap_or("");
238-
format!("{}_{}", s, self.cnt)
235+
format_strbuf!("{}_{}", s, self.cnt)
239236
} else {
240-
format!("{}_{}", self.names.connect("::"), self.cnt)
237+
format_strbuf!("{}_{}", self.names.connect("::"), self.cnt)
241238
};
242239
self.cnt += 1;
243240
let libs = self.libs.clone();

0 commit comments

Comments
 (0)