Skip to content

Commit b0e25b2

Browse files
committed
---
yaml --- r: 3943 b: refs/heads/master c: 47052ce h: refs/heads/master i: 3941: 328e76b 3939: 8175ea9 3935: 3fa5ce0 v: v3
1 parent 1316505 commit b0e25b2

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 4a347760edb8d8c36b9468a5db7185ac0c922ab7
2+
refs/heads/master: 47052ce19ed5493dbed64dd20ad3c629394bd651

trunk/src/lib/test.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,30 +140,22 @@ fn run_tests(&test_opts opts, &test_desc[] tests) -> bool {
140140
ret true;
141141

142142
fn write_ok(&io::writer out) {
143-
if (term::color_supported()) {
144-
term::fg(out.get_buf_writer(), term::color_green);
145-
}
146-
out.write_str("ok");
147-
if (term::color_supported()) {
148-
term::reset(out.get_buf_writer());
149-
}
143+
write_pretty(out, "ok", term::color_green);
150144
}
151145

152146
fn write_failed(&io::writer out) {
153-
if (term::color_supported()) {
154-
term::fg(out.get_buf_writer(), term::color_red);
155-
}
156-
out.write_str("FAILED");
157-
if (term::color_supported()) {
158-
term::reset(out.get_buf_writer());
159-
}
147+
write_pretty(out, "FAILED", term::color_red);
160148
}
161149

162150
fn write_ignored(&io::writer out) {
151+
write_pretty(out, "ignored", term::color_yellow);
152+
}
153+
154+
fn write_pretty(&io::writer out, &str word, u8 color) {
163155
if (term::color_supported()) {
164-
term::fg(out.get_buf_writer(), term::color_yellow);
156+
term::fg(out.get_buf_writer(), color);
165157
}
166-
out.write_str("ignored");
158+
out.write_str(word);
167159
if (term::color_supported()) {
168160
term::reset(out.get_buf_writer());
169161
}

0 commit comments

Comments
 (0)