mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: implement -stats option for running a _test.v file
* 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.
This commit is contained in:

committed by
Alexander Medvednikov

parent
f1923d454c
commit
ac5241b5bd
@@ -7,3 +7,21 @@ pub fn can_show_color_on_stdout() bool {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user