mirror of
https://github.com/vlang/v.git
synced 2025-09-14 23:12:33 +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:
parent
f1923d454c
commit
ac5241b5bd
5 changed files with 181 additions and 20 deletions
|
@ -3821,16 +3821,20 @@ fn (p mut Parser) assert_statement() {
|
|||
p.check_types(p.bool_expression(), 'bool')
|
||||
// TODO print "expected: got" for failed tests
|
||||
filename := p.file_path.replace('\\', '\\\\')
|
||||
p.genln(';\n
|
||||
p.genln(';
|
||||
\n
|
||||
|
||||
if (!$tmp) {
|
||||
println(tos2((byte *)"\\x1B[31mFAILED: $p.cur_fn.name() in $filename:$p.scanner.line_nr\\x1B[0m"));
|
||||
g_test_ok = 0 ;
|
||||
// TODO
|
||||
// Maybe print all vars in a test function if it fails?
|
||||
g_test_fails++;
|
||||
// TODO
|
||||
// Maybe print all vars in a test function if it fails?
|
||||
} else {
|
||||
g_test_oks++;
|
||||
//println(tos2((byte *)"\\x1B[32mPASSED: $p.cur_fn.name()\\x1B[0m"));
|
||||
}
|
||||
else {
|
||||
//puts("\\x1B[32mPASSED: $p.cur_fn.name()\\x1B[0m");
|
||||
}')
|
||||
|
||||
')
|
||||
}
|
||||
|
||||
fn (p mut Parser) return_st() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue