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::Role::TinyCommons::Tree - Test suite for Role::TinyCommons::Tree

VERSION

This document describes version 0.124 of Test::Role::TinyCommons::Tree (from Perl distribution Role-TinyCommons-Tree), released on 2020-04-14.

DESCRIPTION

This module provides a test suite for roles in Role::TinyCommons::Tree distribution.

FUNCTIONS

test_role_tinycommons_tree(%args)

Test a class against roles in Role::TinyCommons::Tree distribution.

To run the tests, you need to provide a class name to test in class. You have to load the class yourself. The class must at least consume the role Role::TinyCommons::Tree::Node (and other roles too, if you want to test the other roles). You also need to provide two subclasses names in subclass1 and subclass2. They must be subclass of the main class, and one must not be subclasses of the other. You are also responsible to load these two subclasses.

Options:

  • class* => str

    The main class to test.

  • subclass1* => str

  • subclass2* => str

  • attribute1 => str (default: id)

    An attribute (rw, int) is needed for testing. The default is id, but you can set a custom attribute.

  • code_instantiate => code

    Required if your constructor does not accept name-value pairs ($class->new(id => ...)). Code will be supplied ($class, \%attrs) and must return an object.

  • constructor_name => str (default: new)

    Must be set if your constructor name is not the default new.

  • test_fromstruct => bool (default: 0)

    Whether to test class against Role::TinyCommons::Tree::FromStruct. If you enable this, your class must consume the role.

    If that attribute needs to be set during construction, and your constructor does not accept name-value pairs ($class->new(id => ...)), then you'll need to supply code_instantiate which will be passed <($class, \%attrs)> so you can instantiate your object yourself.

  • test_nodemethods => bool (default: 0)

    Whether to test class against Role::TinyCommons::Tree::NodeMethods. If you enable this, your class must consume the role.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Role-TinyCommons-Tree.

SOURCE

Source repository is at https://github.com/perlancar/perl-Role-TinyCommons-TreeNode.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Role-TinyCommons-Tree

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020, 2016 by perlancar@cpan.org.

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