The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Test::TraceCalls - which subs were called by which test scripts?

SYNOPSIS

In every module of your project:

        use Test::TraceCalls;

When you run your test suite:

        PERL_TRACE_CALLS=1 prove -lr t

For every file "t/foo.t" in your test suite, Test::TraceCalls will generate "t/foo.t.map" containing a JSON summary of which subs got called by that test file.

DESCRIPTION

Test::TraceCalls will trace calls to:

  • Subs defined the normal way sub name { ... }

  • Subs which have been imported, unless you unimport them later with namespace::autoclean or similar.

  • Subs generated by Moose/Moo/Mouse has.

Test::TraceCalls will NOT trace calls to:

  • Inherited subs, unless the package you inherit from also uses Test::TraceCalls.

  • Subs defined too late. (Including new generated by Moo sometimes.)

  • Subs with names starting with an underscore, but see below.

  • Subs with names not including a lower-case letter, because it's assumed these are just constants, but see below.

The sub name filtering can be controlled by passing a match coderef at import time. The default match coderef is just:

        use Test::TraceCalls match => sub {
                local $_ = shift;
                !/^_/ and /\p{Ll}/;
        };

BUGS

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Test-TraceCalls.

SEE ALSO

https://travis-ci.org/tobyink/p5-test-tracecalls, https://ci.appveyor.com/project/tobyink/p5-test-tracecalls.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2019 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.