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

@ -129,6 +129,9 @@ pub fn new_test_session(_vargs string) TestSession {
vexe := pref.vexe_path()
vroot := os.dir(vexe)
new_vtmp_dir := setup_new_vtmp_folder()
if term.can_show_color_on_stderr() {
os.setenv('VCOLORS', 'always', true)
}
return TestSession{
vexe: vexe
vroot: vroot
@ -273,7 +276,8 @@ fn worker_trunner(mut p sync.PoolProcessor, idx int, thread_id int) voidptr {
ts.failed = true
ts.benchmark.fail()
tls_bench.fail()
ts.append_message(.fail, tls_bench.step_message_fail('$relative_file\n$r.output\n'))
ending_newline := if r.output.ends_with('\n') { '\n' } else { '' }
ts.append_message(.fail, tls_bench.step_message_fail('$relative_file\n$r.output.trim_space()$ending_newline'))
} else {
ts.benchmark.ok()
tls_bench.ok()