Skip to content

Commit f832339

Browse files
committed
compiletest: Use lines_each instead of lines(..).each, or split(.., n).each
1 parent 429b8a9 commit f832339

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/compiletest/runtest.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn run_debuginfo_test(config: config, props: TestProps, testfile: &Path) {
267267
// check if each line in props.check_lines appears in the
268268
// output (in order)
269269
let mut i = 0u;
270-
for str::lines(ProcRes.stdout).each |line| {
270+
for str::lines_each(ProcRes.stdout) |line| {
271271
if props.check_lines[i].trim() == line.trim() {
272272
i += 1u;
273273
}
@@ -297,8 +297,8 @@ fn check_error_patterns(props: TestProps,
297297
let mut next_err_idx = 0u;
298298
let mut next_err_pat = props.error_patterns[next_err_idx];
299299
let mut done = false;
300-
for str::split_char(ProcRes.stderr, '\n').each |line| {
301-
if str::contains(*line, next_err_pat) {
300+
for str::lines_each(ProcRes.stderr) |line| {
301+
if str::contains(line, next_err_pat) {
302302
debug!("found error pattern %s", next_err_pat);
303303
next_err_idx += 1u;
304304
if next_err_idx == vec::len(props.error_patterns) {
@@ -347,15 +347,15 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
347347
// filename:line1:col1: line2:col2: *warning:* msg
348348
// where line1:col1: is the starting point, line2:col2:
349349
// is the ending point, and * represents ANSI color codes.
350-
for str::split_char(ProcRes.stderr, '\n').each |line| {
350+
for str::lines_each(ProcRes.stderr) |line| {
351351
let mut was_expected = false;
352352
for vec::eachi(expected_errors) |i, ee| {
353353
if !found_flags[i] {
354354
debug!("prefix=%s ee.kind=%s ee.msg=%s line=%s",
355-
prefixes[i], ee.kind, ee.msg, *line);
356-
if (str::starts_with(*line, prefixes[i]) &&
357-
str::contains(*line, ee.kind) &&
358-
str::contains(*line, ee.msg)) {
355+
prefixes[i], ee.kind, ee.msg, line);
356+
if (str::starts_with(line, prefixes[i]) &&
357+
str::contains(line, ee.kind) &&
358+
str::contains(line, ee.msg)) {
359359
found_flags[i] = true;
360360
was_expected = true;
361361
break;
@@ -364,13 +364,13 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
364364
}
365365

366366
// ignore this msg which gets printed at the end
367-
if str::contains(*line, ~"aborting due to") {
367+
if str::contains(line, ~"aborting due to") {
368368
was_expected = true;
369369
}
370370

371-
if !was_expected && is_compiler_error_or_warning(*line) {
371+
if !was_expected && is_compiler_error_or_warning(str::from_slice(line)) {
372372
fatal_ProcRes(fmt!("unexpected compiler error or warning: '%s'",
373-
*line),
373+
line),
374374
ProcRes);
375375
}
376376
}

0 commit comments

Comments
 (0)