Skip to content

Commit 102421d

Browse files
committed
Raise an error when a test case is called twice
1 parent 2b85f8a commit 102421d

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

vunit/vhdl/run/src/run.vhd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ package body run_pkg is
246246
set_running_test_case(runner_state, name);
247247
return true;
248248
elsif get_test_case_name(runner_state, get_active_test_case_index(runner_state)) = name then
249-
-- error(runner_trace_logger, "Test case: " & name & " cannot be run more than once unless re-initialization");
249+
error(runner_trace_logger, "Test case: " & name & " cannot be run more than once unless re-initialization.");
250250
return false;
251251
end if;
252252
end if;

vunit/vhdl/run/test/run_tests.vhd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,15 +471,17 @@ begin
471471
banner("Should prevent from running a test from enabled_test_case more than once unless re-initialized.");
472472
test_case_setup;
473473
test_runner_setup(runner, "enabled_test_cases : Should one");
474-
for i in 0 to 1 loop
474+
for i in 0 to 2 loop
475475
case i is
476476
when 0 =>
477477
check(c, run("Should one"), "Expected ""Should one"" to run.");
478478
when others =>
479+
mock(runner_trace_logger);
479480
check_false(c, run("Should one"), "Didn't expected ""Should one"" to run.");
481+
check_log(runner_trace_logger, "Test case: Should one cannot be run more than once unless re-initialization.", error);
482+
unmock(runner_trace_logger);
480483
end case;
481484
end loop;
482-
check_false(c, run("Should one"), "Didn't expect ""Should one"" to run.");
483485
test_runner_setup(runner, "enabled_test_cases : Should one");
484486
while test_suite loop
485487
check(c, run("Should one"), "Expected ""Should one"" to run.");

0 commit comments

Comments
 (0)