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

tests: colorize failing tests, improve layout (#8066)

This commit is contained in:
Daniel Däschle
2021-01-13 10:07:12 +01:00
committed by GitHub
parent 4cd50ed566
commit a22982d662
5 changed files with 89 additions and 39 deletions

View File

@ -30,7 +30,8 @@ pub fn can_show_color_on_stderr() bool {
// If colors are not allowed, returns a given string.
pub fn ok_message(s string) string {
return if can_show_color_on_stdout() {
green(s)
msg := ' $s '
green(msg)
} else {
s
}
@ -40,7 +41,8 @@ pub fn ok_message(s string) string {
// If colors are not allowed, returns a given string.
pub fn fail_message(s string) string {
return if can_show_color_on_stdout() {
bold(bg_red(white(s)))
msg := ' $s '
inverse(bg_white(bold(red(msg))))
} else {
s
}
@ -50,7 +52,7 @@ pub fn fail_message(s string) string {
// If colors are not allowed, returns a given string.
pub fn warn_message(s string) string {
return if can_show_color_on_stdout() {
bright_yellow(s)
bright_yellow(' $s ')
} else {
s
}