Skip to content

Commit 86e613c

Browse files
committed
compiletest: Remove usage of fmt!
1 parent da24c0d commit 86e613c

File tree

5 files changed

+87
-87
lines changed

5 files changed

+87
-87
lines changed

src/compiletest/compiletest.rs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,23 @@ pub fn parse_config(args: ~[~str]) -> config {
8282
let argv0 = args[0].clone();
8383
let args_ = args.tail();
8484
if args[1] == ~"-h" || args[1] == ~"--help" {
85-
let message = fmt!("Usage: %s [OPTIONS] [TESTNAME...]", argv0);
85+
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
8686
println(getopts::groups::usage(message, groups));
8787
println("");
88-
fail!()
88+
fail2!()
8989
}
9090

9191
let matches =
9292
&match getopts::groups::getopts(args_, groups) {
9393
Ok(m) => m,
94-
Err(f) => fail!(f.to_err_msg())
94+
Err(f) => fail2!(f.to_err_msg())
9595
};
9696

9797
if matches.opt_present("h") || matches.opt_present("help") {
98-
let message = fmt!("Usage: %s [OPTIONS] [TESTNAME...]", argv0);
98+
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
9999
println(getopts::groups::usage(message, groups));
100100
println("");
101-
fail!()
101+
fail2!()
102102
}
103103

104104
fn opt_path(m: &getopts::Matches, nm: &str) -> Path {
@@ -152,29 +152,29 @@ pub fn parse_config(args: ~[~str]) -> config {
152152

153153
pub fn log_config(config: &config) {
154154
let c = config;
155-
logv(c, fmt!("configuration:"));
156-
logv(c, fmt!("compile_lib_path: %s", config.compile_lib_path));
157-
logv(c, fmt!("run_lib_path: %s", config.run_lib_path));
158-
logv(c, fmt!("rustc_path: %s", config.rustc_path.to_str()));
159-
logv(c, fmt!("src_base: %s", config.src_base.to_str()));
160-
logv(c, fmt!("build_base: %s", config.build_base.to_str()));
161-
logv(c, fmt!("stage_id: %s", config.stage_id));
162-
logv(c, fmt!("mode: %s", mode_str(config.mode)));
163-
logv(c, fmt!("run_ignored: %b", config.run_ignored));
164-
logv(c, fmt!("filter: %s", opt_str(&config.filter)));
165-
logv(c, fmt!("runtool: %s", opt_str(&config.runtool)));
166-
logv(c, fmt!("rustcflags: %s", opt_str(&config.rustcflags)));
167-
logv(c, fmt!("jit: %b", config.jit));
168-
logv(c, fmt!("target: %s", config.target));
169-
logv(c, fmt!("adb_path: %s", config.adb_path));
170-
logv(c, fmt!("adb_test_dir: %s", config.adb_test_dir));
171-
logv(c, fmt!("adb_device_status: %b", config.adb_device_status));
155+
logv(c, format!("configuration:"));
156+
logv(c, format!("compile_lib_path: {}", config.compile_lib_path));
157+
logv(c, format!("run_lib_path: {}", config.run_lib_path));
158+
logv(c, format!("rustc_path: {}", config.rustc_path.to_str()));
159+
logv(c, format!("src_base: {}", config.src_base.to_str()));
160+
logv(c, format!("build_base: {}", config.build_base.to_str()));
161+
logv(c, format!("stage_id: {}", config.stage_id));
162+
logv(c, format!("mode: {}", mode_str(config.mode)));
163+
logv(c, format!("run_ignored: {}", config.run_ignored));
164+
logv(c, format!("filter: {}", opt_str(&config.filter)));
165+
logv(c, format!("runtool: {}", opt_str(&config.runtool)));
166+
logv(c, format!("rustcflags: {}", opt_str(&config.rustcflags)));
167+
logv(c, format!("jit: {}", config.jit));
168+
logv(c, format!("target: {}", config.target));
169+
logv(c, format!("adb_path: {}", config.adb_path));
170+
logv(c, format!("adb_test_dir: {}", config.adb_test_dir));
171+
logv(c, format!("adb_device_status: {}", config.adb_device_status));
172172
match config.test_shard {
173173
None => logv(c, ~"test_shard: (all)"),
174-
Some((a,b)) => logv(c, fmt!("test_shard: %u.%u", a, b))
174+
Some((a,b)) => logv(c, format!("test_shard: {}.{}", a, b))
175175
}
176-
logv(c, fmt!("verbose: %b", config.verbose));
177-
logv(c, fmt!("\n"));
176+
logv(c, format!("verbose: {}", config.verbose));
177+
logv(c, format!("\n"));
178178
}
179179

180180
pub fn opt_str<'a>(maybestr: &'a Option<~str>) -> &'a str {
@@ -203,7 +203,7 @@ pub fn str_mode(s: ~str) -> mode {
203203
~"pretty" => mode_pretty,
204204
~"debug-info" => mode_debug_info,
205205
~"codegen" => mode_codegen,
206-
_ => fail!("invalid mode")
206+
_ => fail2!("invalid mode")
207207
}
208208
}
209209

@@ -226,7 +226,7 @@ pub fn run_tests(config: &config) {
226226
// For context, see #8904
227227
rt::test::prepare_for_lots_of_tests();
228228
let res = test::run_tests_console(&opts, tests);
229-
if !res { fail!("Some tests failed"); }
229+
if !res { fail2!("Some tests failed"); }
230230
}
231231

232232
pub fn test_opts(config: &config) -> test::TestOpts {
@@ -244,13 +244,13 @@ pub fn test_opts(config: &config) -> test::TestOpts {
244244
}
245245

246246
pub fn make_tests(config: &config) -> ~[test::TestDescAndFn] {
247-
debug!("making tests from %s",
247+
debug2!("making tests from {}",
248248
config.src_base.to_str());
249249
let mut tests = ~[];
250250
let dirs = os::list_dir_path(&config.src_base);
251251
for file in dirs.iter() {
252252
let file = file.clone();
253-
debug!("inspecting file %s", file.to_str());
253+
debug2!("inspecting file {}", file.to_str());
254254
if is_test(config, &file) {
255255
let t = do make_test(config, &file) {
256256
match config.mode {
@@ -306,12 +306,12 @@ pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {
306306
let filename = path.filename();
307307
let p = path.pop();
308308
let dir = p.filename();
309-
fmt!("%s/%s", dir.unwrap_or(""), filename.unwrap_or(""))
309+
format!("{}/{}", dir.unwrap_or(""), filename.unwrap_or(""))
310310
}
311311

312-
test::DynTestName(fmt!("[%s] %s",
313-
mode_str(config.mode),
314-
shorten(testfile)))
312+
test::DynTestName(format!("[{}] {}",
313+
mode_str(config.mode),
314+
shorten(testfile)))
315315
}
316316

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

src/compiletest/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] {
5656
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
5757
let msg = line.slice(idx, len).to_owned();
5858

59-
debug!("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
59+
debug2!("line={} kind={} msg={}", line_num - adjust_line, kind, msg);
6060

6161
return ~[ExpectedError{line: line_num - adjust_line, kind: kind,
6262
msg: msg}];

src/compiletest/header.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ fn parse_exec_env(line: &str) -> Option<(~str, ~str)> {
150150
let end = strs.pop();
151151
(strs.pop(), end)
152152
}
153-
n => fail!("Expected 1 or 2 strings, not %u", n)
153+
n => fail2!("Expected 1 or 2 strings, not {}", n)
154154
}
155155
}
156156
}
@@ -179,7 +179,7 @@ fn parse_name_value_directive(line: &str,
179179
Some(colon) => {
180180
let value = line.slice(colon + keycolon.len(),
181181
line.len()).to_owned();
182-
debug!("%s: %s", directive, value);
182+
debug2!("{}: {}", directive, value);
183183
Some(value)
184184
}
185185
None => None

0 commit comments

Comments
 (0)