mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v test-fmt: reformat some skipped files, comment on the remaining ones
This commit is contained in:
@ -2,6 +2,7 @@ module main
|
||||
|
||||
import os
|
||||
import term
|
||||
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// / This file will get compiled as part of the main program,
|
||||
// / for a _test.v file.
|
||||
@ -14,29 +15,26 @@ import term
|
||||
fn cb_assertion_failed(i &VAssertMetaInfo) {
|
||||
use_color := term.can_show_color_on_stderr()
|
||||
use_relative_paths := match os.getenv('VERROR_PATHS') {
|
||||
'absolute' {
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
'absolute' { false }
|
||||
else { true }
|
||||
}
|
||||
final_filename := if use_relative_paths { i.fpath } else { os.real_path(i.fpath) }
|
||||
final_funcname := i.fn_name.replace('main.', '').replace('__', '.')
|
||||
final_src := if use_color { term.bold(i.src) } else { i.src }
|
||||
eprintln('')
|
||||
eprintln('$final_filename:${i.line_nr+1}: failed assert in function ${final_funcname}')
|
||||
eprintln('Source : `${final_src}`')
|
||||
eprintln('$final_filename:${i.line_nr+1}: failed assert in function $final_funcname')
|
||||
eprintln('Source : `$final_src`')
|
||||
if i.op.len > 0 && i.op != 'call' {
|
||||
mut slvalue := '${i.lvalue}'
|
||||
mut srvalue := '${i.rvalue}'
|
||||
lpostfix := if slvalue == i.llabel { '.' } else { '<= `${i.llabel}`' }
|
||||
rpostfix := if srvalue == i.rlabel { '.' } else { '<= `${i.rlabel}`' }
|
||||
mut slvalue := '$i.lvalue'
|
||||
mut srvalue := '$i.rvalue'
|
||||
lpostfix := if slvalue == i.llabel { '.' } else { '<= `$i.llabel`' }
|
||||
rpostfix := if srvalue == i.rlabel { '.' } else { '<= `$i.rlabel`' }
|
||||
if use_color {
|
||||
slvalue = term.bold(term.yellow(slvalue))
|
||||
srvalue = term.bold(term.yellow(srvalue))
|
||||
}
|
||||
eprintln(' left value: ${slvalue} ${lpostfix}')
|
||||
eprintln(' right value: ${srvalue} ${rpostfix}')
|
||||
eprintln(' left value: $slvalue $lpostfix')
|
||||
eprintln(' right value: $srvalue $rpostfix')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
module main
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////
|
||||
// / This file will get compiled as a part of the same module,
|
||||
// / in which a given _test.v file is, when v is given -stats argument
|
||||
// / The methods defined here are called back by the test program's
|
||||
// / main function, so that customizing the look & feel of the results
|
||||
// / main function, so that customizing the look & feel of the results
|
||||
// / is easy, since it is done in normal V code, instead of in embedded C ...
|
||||
// /////////////////////////////////////////////////////////////////////
|
||||
import os
|
||||
@ -77,7 +78,8 @@ fn (b &BenchedTests) fn_name() string {
|
||||
// Called at the end of the test program produced by `v -stats file_test.v`
|
||||
fn (mut b BenchedTests) end_testing() {
|
||||
b.bench.stop()
|
||||
println(inner_indent + b.bench.total_message('running V tests in "' + os.file_name(b.test_suit_file) + '"'))
|
||||
println(inner_indent + b.bench.total_message('running V tests in "' + os.file_name(b.test_suit_file) +
|
||||
'"'))
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user