Context-Singleton

 view release on metacpan or  search on metacpan

t/lib/Examples/Context/Singleton/Frame/Builder.pm  view on Meta::CPAN


use v5.10;
use strict;
use warnings;

package Examples::Context::Singleton::Frame::Builder;

our $VERSION = v1.0.0;

use Test::Spec::Util;
use Hash::Util;
use Ref::Util qw[ is_plain_arrayref ];

example expect_required => as {
    my ($title, %params) = @_;
    Hash::Util::lock_keys %params, qw[ object expect ];

    my $object = $params{object} // shared->object;
    my $expect = $params{expect} // [];

    $expect = bag (@$expect)
        if not is_test_deep_comparision ($expect) and is_plain_arrayref ($expect);

    test_list_method $title => (
        method => 'required',
        method_args => [],

        object => $object,
        expect => $expect,
    );
};

example expect_unresolved => as {
    my ($title, %params) = @_;
    Hash::Util::lock_keys %params, qw[ object expect with_deduced ];

    my $object = $params{object} // shared->object;
    my $expect = $params{expect} // [];

    $expect = bag (@$expect)
        if not is_test_deep_comparision ($expect) and is_plain_arrayref ($expect);

    test_list_method $title => (
        method => 'unresolved',
        method_args => [ 'with_deduced' ],
        method_wantarray => 1,

        object => $object,
        expect => $expect,
        with_deduced => $params{with_deduced},
    );
};

example expect_dep => as {
    my ($title, %params) = @_;
    Hash::Util::lock_keys %params, qw[ object expect ];

    test_method $title => (
        method => 'dep',
        method_args => [],

        object => $params{object} // shared->object,
        expect => $params{expect},
    );
};

example expect_default => as {
    my ($title, %params) = @_;
    Hash::Util::lock_keys %params, qw[ object expect ];

    test_hash_method $title => (
        method => 'default',



( run in 1.880 second using v1.01-cache-2.11-cpan-39bf76dae61 )