tests: use term.header_left, and a more compact output layout

pull/10154/head
Delyan Angelov 2021-05-20 10:03:53 +03:00
parent 00b3092a92
commit dd0a97541c
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 10 additions and 8 deletions

View File

@ -441,11 +441,11 @@ pub fn building_any_v_binaries_failed() bool {
}
pub fn eheader(msg string) {
eprintln(term.header(msg, '-'))
eprintln(term.header_left(msg, '-'))
}
pub fn header(msg string) {
println(term.header(msg, '-'))
println(term.header_left(msg, '-'))
}
pub fn setup_new_vtmp_folder() string {

View File

@ -22,9 +22,8 @@ fn main() {
oks := commands.filter(it.ecode == 0)
fails := commands.filter(it.ecode != 0)
println('')
println(term.header(term.colorize(term.yellow, term.colorize(term.bold, 'Summary of `v test-all`:')),
'-'))
println(term.colorize(term.yellow, 'Total runtime: $spent ms'))
println(term.header_left(term_highlight('Summary of `v test-all`:'), '-'))
println(term_highlight('Total runtime: $spent ms'))
for ocmd in oks {
msg := if ocmd.okmsg != '' { ocmd.okmsg } else { ocmd.line }
println(term.colorize(term.green, '> OK: $msg '))
@ -124,11 +123,14 @@ fn (mut cmd Command) run() {
// vlib/v/tests/local_test.v and vlib/v/tests/repl/repl_test.v
os.chdir(vroot)
if cmd.label != '' {
println(term.header(cmd.label, '*'))
println(term.header_left(cmd.label, '*'))
}
sw := time.new_stopwatch({})
cmd.ecode = os.system(cmd.line)
spent := sw.elapsed().milliseconds()
println(term.colorize(term.yellow, '> Running: "$cmd.line" took: $spent ms.'))
println('')
println(term_highlight('> Running: "$cmd.line" took: $spent ms.'))
}
fn term_highlight(s string) string {
return term.colorize(term.yellow, term.colorize(term.bold, s))
}