mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ac5241b5bd
* Draft implementation of `v -stats file_test.v` . * compiler: call stuff in vlib/benchmark/tests/always_imported.v, when doing `v -stats file_test.v` * Nicer looking output from 'v -stats file_test.v' . * Tweak colors and layout of -stats file_test.v . * Fix a hardcoded path in compiler/main.v . * Show colorized OK/FAIL for the examples in 'v test v' too. * Add some comments about the purpose of the methods inside vlib/benchmark/tests/always_imported.v . * when fails are 0, do not colorize their number at all.
28 lines
428 B
V
28 lines
428 B
V
module term
|
|
|
|
pub fn can_show_color_on_stdout() bool {
|
|
return can_show_color_on_fd(1)
|
|
}
|
|
|
|
pub fn can_show_color_on_stderr() bool {
|
|
return can_show_color_on_fd(2)
|
|
}
|
|
|
|
//////////////////////////////////////////////
|
|
|
|
pub fn ok_message(s string) string {
|
|
return if can_show_color_on_stdout() {
|
|
green( s )
|
|
}else{
|
|
s
|
|
}
|
|
}
|
|
|
|
pub fn fail_message(s string) string {
|
|
return if can_show_color_on_stdout() {
|
|
red( s )
|
|
}else{
|
|
s
|
|
}
|
|
}
|