Skip to content

Commit

Permalink
preludes: fix v -skip-unused -stats some_test.v
Browse files Browse the repository at this point in the history
  • Loading branch information
spytheman committed Jan 22, 2024
1 parent bc37c85 commit b593f61
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vlib/v/preludes/tests_with_stats.v
Expand Up @@ -24,6 +24,7 @@ mut:

// ///////////////////////////////////////////////////////////////////
// Called at the start of the test program produced by `v -stats file_test.v`
@[markused]
fn start_testing(total_number_of_tests int, vfilename string) BenchedTests {
mut benched_tests_res := BenchedTests{
bench: benchmark.new_benchmark()
Expand All @@ -35,6 +36,7 @@ fn start_testing(total_number_of_tests int, vfilename string) BenchedTests {
}

// Called before each test_ function, defined in file_test.v
@[markused]
fn (mut b BenchedTests) testing_step_start(stepfunc string) {
b.step_func_name = stepfunc.replace('main.', '').replace('__', '.')
b.oks = test_runner.total_assert_passes
Expand All @@ -44,6 +46,7 @@ fn (mut b BenchedTests) testing_step_start(stepfunc string) {
}

// Called after each test_ function, defined in file_test.v
@[markused]
fn (mut b BenchedTests) testing_step_end() {
ok_diff := int(test_runner.total_assert_passes - b.oks)
fail_diff := int(test_runner.total_assert_fails - b.fails)
Expand Down Expand Up @@ -79,6 +82,7 @@ fn (b &BenchedTests) fn_name() string {
}

// Called at the end of the test program produced by `v -stats file_test.v`
@[markused]
fn (mut b BenchedTests) end_testing() {
b.bench.stop()
fname := os.file_name(b.test_suit_file)
Expand Down

0 comments on commit b593f61

Please sign in to comment.