mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vfmt: change all '$expr' to '${expr}' (#16428)
This commit is contained in:
@@ -123,7 +123,7 @@ pub fn start() Benchmark {
|
||||
pub fn (mut b Benchmark) measure(label string) i64 {
|
||||
b.ok()
|
||||
res := b.step_timer.elapsed().microseconds()
|
||||
println(b.step_message_with_label(benchmark.b_spent, 'in $label'))
|
||||
println(b.step_message_with_label(benchmark.b_spent, 'in ${label}'))
|
||||
b.step()
|
||||
return res
|
||||
}
|
||||
@@ -158,9 +158,9 @@ pub fn (b &Benchmark) step_message_with_label_and_duration(label string, msg str
|
||||
'${b.cstep:4d}/${b.nexpected_steps:4d}'
|
||||
}
|
||||
}
|
||||
return '${label:-5s} [$sprogress] $timed_line'
|
||||
return '${label:-5s} [${sprogress}] ${timed_line}'
|
||||
}
|
||||
return '${label:-5s}$timed_line'
|
||||
return '${label:-5s}${timed_line}'
|
||||
}
|
||||
|
||||
// step_message_with_label returns a string describing the current step using current time as duration.
|
||||
@@ -191,15 +191,17 @@ pub fn (b &Benchmark) step_message_skip(msg string) string {
|
||||
// total_message returns a string with total summary of the benchmark run.
|
||||
pub fn (b &Benchmark) total_message(msg string) string {
|
||||
the_label := term.colorize(term.gray, msg)
|
||||
// vfmt off
|
||||
mut tmsg := '${term.colorize(term.bold, 'Summary for $the_label:')} '
|
||||
// vfmt on
|
||||
if b.nfail > 0 {
|
||||
tmsg += term.colorize(term.bold, term.colorize(term.red, '$b.nfail failed')) + ', '
|
||||
tmsg += term.colorize(term.bold, term.colorize(term.red, '${b.nfail} failed')) + ', '
|
||||
}
|
||||
if b.nok > 0 {
|
||||
tmsg += term.colorize(term.bold, term.colorize(term.green, '$b.nok passed')) + ', '
|
||||
tmsg += term.colorize(term.bold, term.colorize(term.green, '${b.nok} passed')) + ', '
|
||||
}
|
||||
if b.nskip > 0 {
|
||||
tmsg += term.colorize(term.bold, term.colorize(term.yellow, '$b.nskip skipped')) + ', '
|
||||
tmsg += term.colorize(term.bold, term.colorize(term.yellow, '${b.nskip} skipped')) + ', '
|
||||
}
|
||||
mut njobs_label := ''
|
||||
if b.njobs > 0 {
|
||||
@@ -209,7 +211,7 @@ pub fn (b &Benchmark) total_message(msg string) string {
|
||||
njobs_label = ', on ${term.colorize(term.bold, b.njobs.str())} parallel jobs'
|
||||
}
|
||||
}
|
||||
tmsg += '$b.ntotal total. ${term.colorize(term.bold, 'Runtime:')} ${b.bench_timer.elapsed().microseconds() / 1000} ms${njobs_label}.\n'
|
||||
tmsg += '${b.ntotal} total. ${term.colorize(term.bold, 'Runtime:')} ${b.bench_timer.elapsed().microseconds() / 1000} ms${njobs_label}.\n'
|
||||
return tmsg
|
||||
}
|
||||
|
||||
@@ -221,7 +223,7 @@ pub fn (b &Benchmark) total_duration() i64 {
|
||||
// tdiff_in_ms prefixes `s` with a time difference calculation.
|
||||
fn (b &Benchmark) tdiff_in_ms(s string, tdiff i64) string {
|
||||
if b.verbose {
|
||||
return '${f64(tdiff) / 1000.0:9.3f} ms $s'
|
||||
return '${f64(tdiff) / 1000.0:9.3f} ms ${s}'
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user