Determine if function is called in a test using Perl -


i use test::more

i want see if 1 of functions called or not. there 2 scenarios have: 1 not call function, other will. function not mocked out, want see if called or not.

something like:

my $called; $orig_function = \&yourpackage::yourfunction; {     no warnings 'redefine';     *yourpackage::yourfunction = sub { ++$called; goto &$orig_function }; } # code may or may not call yourfunction here ok($called, 'function called'); 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -