1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

term: add term.colorize/2, use it in the tests. Support ConEmuANSI = ON too.

This commit is contained in:
Delyan Angelov
2021-01-17 19:09:29 +02:00
parent 75af639721
commit 3ee78dc961
4 changed files with 28 additions and 17 deletions

View File

@@ -77,7 +77,7 @@ fn (mut cmd Command) run() {
sw := time.new_stopwatch({})
cmd.ecode = os.system(cmd.line)
spent := sw.elapsed().milliseconds()
println(term.yellow('> Running: "$cmd.line" took: $spent ms.'))
println(term.colorize(term.yellow, '> Running: "$cmd.line" took: $spent ms.'))
println('')
}
@@ -90,15 +90,16 @@ fn (commands []Command) summary() {
oks := commands.filter(it.ecode == 0)
fails := commands.filter(it.ecode != 0)
println('')
println(term.header(term.yellow(term.bold('Summary of `v test-all`:')), '-'))
println(term.yellow('Total runtime: $spent ms'))
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'))
for ocmd in oks {
msg := if ocmd.okmsg != '' { ocmd.okmsg } else { ocmd.line }
println(term.green('> OK: $msg '))
println(term.colorize(term.green, '> OK: $msg '))
}
for fcmd in fails {
msg := if fcmd.errmsg != '' { fcmd.errmsg } else { fcmd.line }
println(term.red('> Failed: $msg '))
println(term.colorize(term.red, '> Failed: $msg '))
}
if fails.len > 0 {
exit(1)

View File

@@ -6,7 +6,6 @@ import v.pref
const (
skip_with_fsanitize_memory = [
'vlib/x/websocket/websocket_test.v',
'vlib/encoding/csv/reader_test.v',
'vlib/net/tcp_test.v',
'vlib/net/tcp_simple_client_server_test.v',
@@ -17,8 +16,8 @@ const (
'vlib/orm/orm_test.v',
'vlib/sqlite/sqlite_test.v',
'vlib/vweb/tests/vweb_test.v',
'vlib/x/websocket/websocket_test.v',
'vlib/v/tests/unsafe_test.v',
'vlib/x/websocket/websocket_test.v',
'vlib/net/http/http_httpbin_test.v',
]
skip_with_fsanitize_address = [