Hades

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	- fix abstract { } and synopsis { } sections
	- Add test { } syntax to specify class_tests
	- Add :pod and :example attributes to accessors and subs.

0.14    2020-08-29
	- require Types::Standard in realm tests (thanks SREZIC).
	- catch unknown attributes with a default in the switch.

0.15    2020-08-31
	- refactor macro code to be more usefull.
	- Adds Hades::Macro and Hades::Macro::FH.
	- Adds £ shorthand for calling methods/accessors on $self.
	- Adds € shorthand for calling macros.

0.16    2020-09-01
	- Adds builders to accessors - elpis :builder
	- Fix parsing of compile phase blocks.

0.17    2020-09-02
	- Adds Hades::Macro::Dolos for some more abstraction.
	- Adds :no_success_test attribute to skip "valid" tests on attributes that have builders/triggers.
	- Attempt to fix parsing of macros.

0.18    2020-09-04
	- Re-write macro parsing
	- Adds a very basic verbose and debug mode so you can gain some kind of insight when things go wrong.
	- Adds Hades::Myths and Hades::Myths::Object for handling build_step messages.

MANIFEST  view on Meta::CPAN

bin/hades
Changes
lib/Hades.pm
lib/Hades/Macro.pm
lib/Hades/Macro/Dolos.pm
lib/Hades/Macro/FH.pm
lib/Hades/Myths.pm
lib/Hades/Myths/Object.pm
macro-dolos.hades
macro-fh.hades
macro.hades
Makefile.PL
MANIFEST			This list of files
myths.hades
README
t/00-load.t

MANIFEST  view on Meta::CPAN

t/03-subs.t
t/04-test.t
t/05-realms.t
t/06-realms-test.t
t/07-ahh.t
t/08-types.t
t/09-pod.t
t/10-macro.t
t/11-builder.t
t/12-dolos.t
t/Hades-Macro-Dolos.t
t/Hades-Macro-FH.t
t/Hades-Macro.t
t/Hades-Myths-Object.t
t/Hades-Myths.t
t/manifest.t
t/pod-coverage.t
t/pod.t
xt/boilerplate.t
META.yml                                 Module YAML meta-data (added by MakeMaker)
META.json                                Module JSON meta-data (added by MakeMaker)

lib/Hades.pm  view on Meta::CPAN

		},
	);
}

sub build_macro {
	my ($self, $mg, $class) = @_;
	my $meta = $self->{macros};
	for my $macro (@{$class}) {
		$self->debug_step(debug_step_6, $macro);
		if ($macro->[-1] !~  m/^{/) {
			my $include = sprintf "Hades::Macro::%s", shift @{$macro};
			$self->debug_step(sprintf(debug_step_7, $include), $macro);
			eval qq|require $include|;
			die $@ if $@;
			my $include_meta = $include->new($macro->[0] ? do {
				$macro->[0] =~ s/^\[|\]$//g;
				( eval qq|$macro->[0]| );
			} : ())->meta;
			$self->debug_step(sprintf(debug_step_8, $include), $include_meta);
			$meta = {%{$meta}, %{$include_meta}};
		} else {

lib/Hades.pm  view on Meta::CPAN

=cut

=head3 Optional

Used in conjunction with Dict and Tuple to specify slots that are optional and may be omitted.

	dokimi :t(Optional[Str])

=cut

=head2 Macros

Hades has a concept of macros that allow you to write re-usable code. see L<https://metacpan.org/source/LNATION/Hades-0.24/macro-fh.hades> for an example of how to extend via macros.

	macro {
		FH [ macro => [qw/read_file write_file/], alias => { read_file => [qw/rf/], write_file => [qw/wf/] } ]
		str2ArrayRef :a(s2ar) {
			return qq|$params[0] = [ $params[0] ];|;
		}
		ArrayRef2Str :a(ar2s) {
			return qq|$params[0] = $params[0]\->[0];|;
		}
	}
	MacroKosmos {
		eros $eros :t(Str) :d(t/test.txt) {
			€s2ar('$eros');
			€ar2s('$eros');
			€wf('$eros', q|'this is a test'|);
			return $eros;
		}
		psyche $psyche :t(Str) :d(t/test.txt) {
			€rf('$psyche');
			return $content;
		}
	}

	... generates ...

	package MacroKosmos;
	use strict;
	use warnings;
	our $VERSION = 0.01;

	sub new {
		my ( $cls, %args ) = ( shift(), scalar @_ == 1 ? %{ $_[0] } : @_ );
		my $self = bless {}, $cls;
		my %accessors = ();
		for my $accessor ( keys %accessors ) {
			my $value

lib/Hades/Macro.pm  view on Meta::CPAN

package Hades::Macro;
use strict;
use warnings;
our $VERSION = 0.24;

sub new {
	my ( $cls, %args ) = ( shift(), scalar @_ == 1 ? %{ $_[0] } : @_ );
	my $self      = bless {}, $cls;
	my %accessors = ( alias => {}, macro => { default => [], }, );
	for my $accessor ( keys %accessors ) {
		my $param

lib/Hades/Macro.pm  view on Meta::CPAN

	return $meta;

}

1;

__END__

=head1 NAME

Hades::Macro - Hades macro base class.

=head1 VERSION

Version 0.24

=cut

=head1 SYNOPSIS

Quick summary of what the module does:

	Hades::Macro::Kosmos base Hades::Macro {
		macro :t(ArrayRef) :d([qw/geras/])
		geras $mg :t(Object) { 
			return q|...|;
		}
	}

=head1 SUBROUTINES/METHODS

=head2 new

Instantiate a new Hades::Macro object.

	Hades::Macro->new

=head2 has_alias

has_alias will return true if alias accessor has a value.

	$obj->has_alias

=head2 meta

call meta method. Expects param $meta to be a HashRef.

lib/Hades/Macro.pm  view on Meta::CPAN


	$obj->alias($value);

=head1 AUTHOR

LNATION, C<< <email at lnation.org> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-hades::macro at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hades-Macro>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Hades::Macro

You can also look for information at:

=over 2

=item * RT: CPAN's request tracker (report bugs here)

L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Hades-Macro>

=item * Search CPAN

L<https://metacpan.org/release/Hades-Macro>

=back

=head1 ACKNOWLEDGEMENTS

=head1 LICENSE AND COPYRIGHT

This software is Copyright (c) 2020 by LNATION.

This is free software, licensed under:

lib/Hades/Macro/Dolos.pm  view on Meta::CPAN

package Hades::Macro::Dolos;
use strict;
use warnings;
use base qw/Hades::Macro/;
our $VERSION = 0.24;

sub new {
	my ( $cls, %args ) = ( shift(), scalar @_ == 1 ? %{ $_[0] } : @_ );
	my $self      = $cls->SUPER::new(%args);
	my %accessors = (
		macro => {
			default => [
				qw/
				    autoload_cb

lib/Hades/Macro/Dolos.pm  view on Meta::CPAN

	return qq|while ($condition) { $c }|;

}

1;

__END__

=head1 NAME

Hades::Macro::Dolos - Hades macro helpers for Dolos

=head1 VERSION

Version 0.24

=cut

=head1 SYNOPSIS

Quick summary of what the module does:

lib/Hades/Macro/Dolos.pm  view on Meta::CPAN

					return undef;
				}
			}
		|;
	});

=head1 SUBROUTINES/METHODS

=head2 new

Instantiate a new Hades::Macro::Dolos object.

	Hades::Macro::Dolos->new

=head2 autoload_cb

call autoload_cb method. Expects param $mg to be a Object, param $cb to be a Str.

	$obj->autoload_cb($mg, $cb)

=head2 caller

call caller method. Expects param $mg to be a Object, param $variable to be a Str.

lib/Hades/Macro/Dolos.pm  view on Meta::CPAN


	$obj->macro($value);

=head1 AUTHOR

LNATION, C<< <email at lnation.org> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-hades::macro::dolos at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hades-Macro-Dolos>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Hades::Macro::Dolos

You can also look for information at:

=over 2

=item * RT: CPAN's request tracker (report bugs here)

L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Hades-Macro-Dolos>

=item * Search CPAN

L<https://metacpan.org/release/Hades-Macro-Dolos>

=back

=head1 ACKNOWLEDGEMENTS

=head1 LICENSE AND COPYRIGHT

This software is Copyright (c) 2020 by LNATION.

This is free software, licensed under:

lib/Hades/Macro/FH.pm  view on Meta::CPAN

package Hades::Macro::FH;
use strict;
use warnings;
use base qw/Hades::Macro/;
our $VERSION = 0.24;

sub new {
	my ( $cls, %args ) = ( shift(), scalar @_ == 1 ? %{ $_[0] } : @_ );
	my $self      = $cls->SUPER::new(%args);
	my %accessors = (
		macro => {
			default =>
			    [qw/open_write open_read close_file read_file write_file/],
		},

lib/Hades/Macro/FH.pm  view on Meta::CPAN

	    . qq|close $variable;|;

}

1;

__END__

=head1 NAME

Hades::Macro::FH - Hades macro helpers for FH

=head1 VERSION

Version 0.24

=cut

=head1 SYNOPSIS

Quick summary of what the module does:

lib/Hades/Macro/FH.pm  view on Meta::CPAN

	}

	1;

	__END__

=head1 SUBROUTINES/METHODS

=head2 new

Instantiate a new Hades::Macro::FH object.

	Hades::Macro::FH->new

=head2 open_write

call open_write method. Expects param $mg to be a Object, param $file to be a Str, param $variable to be a Str, param $error to be a Str.

	$obj->open_write($mg, $file, $variable, $error)

=head2 open_read

call open_read method. Expects param $mg to be a Object, param $file to be a Str, param $variable to be a Str, param $error to be a Str.

lib/Hades/Macro/FH.pm  view on Meta::CPAN


	$obj->macro($value);

=head1 AUTHOR

LNATION, C<< <email at lnation.org> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-hades::macro::fh at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hades-Macro-FH>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Hades::Macro::FH

You can also look for information at:

=over 2

=item * RT: CPAN's request tracker (report bugs here)

L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Hades-Macro-FH>

=item * Search CPAN

L<https://metacpan.org/release/Hades-Macro-FH>

=back

=head1 ACKNOWLEDGEMENTS

=head1 LICENSE AND COPYRIGHT

This software is Copyright (c) 2020 by LNATION.

This is free software, licensed under:

lib/Hades/Myths/Object.pm  view on Meta::CPAN

		    { en => 'Constructed the new sub routine for class %s.' },
		debug_step_35 => { en => 'Finished Compiling the class.' },
		debug_step_36 => { en => 'Finished Compiling all classes.' },
		debug_step_37 => {
			en =>
			    'Calling Module::Generates generate method which will write the files to disk.'
		},
		debug_step_38 => { en => 'Constructing code for %s.', },
		debug_step_39 => { en => 'Build macro for: %s.' },
		debug_step_40 => { en => 'Matched macro %s that has parameters.' },
		debug_step_41 => { en => 'Macro %s has a code callback.' },
		debug_step_42 => { en => 'Generated code for macro %s.' },
		debug_step_43 => { en => 'Match macro %s that has no parameters.' },
		debug_step_44 => { en => 'Constructed code for %s.', },
		debug_step_45 => { en => 'Constructing predicate named has_%s.' },
		debug_step_46 => { en => 'Constructed predicate named has_%s.' },
		debug_step_47 => { en => 'Constructing clearer named clearer_%s.' },
		debug_step_48 => { en => 'Constructed clearer named clearer_%s.' },
		press_enter_to_continue => { en => 'Press enter to continue' },
	};
	return $steps;

macro-dolos.hades  view on Meta::CPAN

lib lib
tlib t
author LNATION
email email@lnation.org
version 0.24
Hades::Macro::Dolos base Hades::Macro {
	abstract { Hades macro helpers for Dolos }
	synopsis {
Quick summary of what the module does:

	Hades->run({
		eval => q|
			macro {
				Dolos
			}
			Kosmos { 

macro-fh.hades  view on Meta::CPAN

lib lib
tlib t
author LNATION
email email@lnation.org
version 0.24
Hades::Macro::FH base Hades::Macro {
	abstract { Hades macro helpers for FH }
	synopsis {
Quick summary of what the module does:

	Hades->run({
		eval => q|
			macro {
				FH [ alias => { read_file => [qw/rf/], write_file => [qw/wf/] } ]
			}
			Kosmos { 

macro.hades  view on Meta::CPAN

lib lib
tlib t
author LNATION
email email@lnation.org
version 0.24
Hades::Macro {
	abstract { Hades macro base class. }
	synopsis {
Quick summary of what the module does:

	Hades::Macro::Kosmos base Hades::Macro {
		macro :t(ArrayRef) :d([qw/geras/])
		geras $mg :t(Object) { 
			return q|...|;
		}
	}

	}
	macro :t(ArrayRef) :d([])
	alias :t(HashRef[ArrayRef]) :pr
	meta $meta :t(HashRef) :d({}) {

myths.hades  view on Meta::CPAN

			debug_step_38 => {
				en => 'Constructing code for %s.',
			},	
			debug_step_39 => {
				en => 'Build macro for: %s.'
			},					
			debug_step_40 => {
				en => 'Matched macro %s that has parameters.'
			},
			debug_step_41 => {
				en => 'Macro %s has a code callback.'
			},
			debug_step_42 => {
				en => 'Generated code for macro %s.'
			},
			debug_step_43 => {
				en => 'Match macro %s that has no parameters.'
			},
			debug_step_44 => {
				en => 'Constructed code for %s.',
			},

t/10-macro.t  view on Meta::CPAN

		eval => q`
			macro {
				FH [ alias => { read_file => [qw/rf/], write_file => [qw/wf/] } ]
				str2ArrayRef :a(s2ar) {
					return qq|$params[0] = [ $params[0] ];|;
				}
				ArrayRef2Str :a(ar2s) {
					return qq|$params[0] = $params[0]\->[0];|;
				}
			}
			KosmosMacro { 
				[penthos curae] :t(Int) :d(2) :p :pr :c :r 
				geras $nosoi :t(Int) :d(5) { if (£penthos == $nosoi) { return £curae; } } 
				eros $eros :t(Str) :d(t/test.txt) {
					€s2ar('$eros');
					€ar2s('$eros');
					€wf('$eros', q|'this is a test'|);
					return $eros;
				}
				psyche $psyche :t(Str) :d(t/test.txt) {
					€rf('$psyche');
					return $content;
				}
			}
		`,
		lib => 't/lib'
	});
	use lib 't/lib';
}
use KosmosMacro;
my $okay = KosmosMacro->new({
	curae => 5
});
eval { $okay->penthos };
like( $@, qr/^cannot call private method penthos/);
is($okay->has_curae, 1);
is($okay->geras(2), 5);
is($okay->eros(), 't/test.txt');
is($okay->psyche(), 'this is a test');

done_testing;

t/Hades-Macro-Dolos.t  view on Meta::CPAN

use Test::More;
use strict;
use warnings;
our ( $sub, $globref );

BEGIN {
	use_ok('Hades::Macro::Dolos');
	$sub     = sub { };
	$globref = \*globref;
}
subtest 'new' => sub {
	plan tests => 9;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	ok( $obj = Hades::Macro::Dolos->new(),
		q{$obj = Hades::Macro::Dolos->new()}
	);
	isa_ok( $obj, 'Hades::Macro::Dolos' );
	ok( $obj = Hades::Macro::Dolos->new( {} ),
		q{$obj = Hades::Macro::Dolos->new({})}
	);
	ok( $obj = Hades::Macro::Dolos->new(),
		q{$obj = Hades::Macro::Dolos->new()}
	);
	is_deeply(
		$obj->macro,
		[   qw/
			    autoload_cb
			    caller
			    clear_unless_keys
			    call_sub
			    call_sub_my
			    delete

t/Hades-Macro-Dolos.t  view on Meta::CPAN

			    map_grep
			    maybe
			    merge_hash_refs
			    require
			    unless
			    while
			    /
		],
		q{$obj->macro}
	);
	ok( $obj = Hades::Macro::Dolos->new( { macro => ['test'] } ),
		q{$obj = Hades::Macro::Dolos->new({ macro => ['test'] })}
	);
	eval { $obj = Hades::Macro::Dolos->new( { macro => {} } ) };
	like(
		$@,
		qr/invalid|type|constraint|greater|atleast/i,
		q{$obj = Hades::Macro::Dolos->new({ macro => {} })}
	);
	eval { $obj = Hades::Macro::Dolos->new( { macro => 'nosoi' } ) };
	like(
		$@,
		qr/invalid|type|constraint|greater|atleast/i,
		q{$obj = Hades::Macro::Dolos->new({ macro => 'nosoi' })}
	);
};
subtest 'macro' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'macro' );
	is_deeply( $obj->macro( ['test'] ), ['test'], q{$obj->macro(['test'])} );
	eval { $obj->macro( {} ) };
	like( $@, qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->macro({})} );
	eval { $obj->macro('phobos') };
	like( $@, qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->macro('phobos')} );
	is_deeply( $obj->macro, ['test'], q{$obj->macro} );
};
subtest 'autoload_cb' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'autoload_cb' );
	eval { $obj->autoload_cb( [], 'curae' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->autoload_cb([], 'curae')}
	);
	eval { $obj->autoload_cb( 'aporia', 'curae' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->autoload_cb( bless( {}, 'Test' ), \1 ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->autoload_cb(bless({}, 'Test'), \1)}
	);
};
subtest 'caller' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'caller' );
	eval { $obj->caller( [], 'penthos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->caller([], 'penthos')}
	);
	eval { $obj->caller( 'phobos', 'penthos' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->caller( bless( {}, 'Test' ), \1 ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->caller(bless({}, 'Test'), \1)}
	);
};
subtest 'clear_unless_keys' => sub {
	plan tests => 8;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'clear_unless_keys' );
	eval { $obj->clear_unless_keys( [], 'algea', 'geras' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->clear_unless_keys([], 'algea', 'geras')}
	);
	eval { $obj->clear_unless_keys( 'limos', 'algea', 'geras' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->clear_unless_keys( bless( {}, 'Test' ), 'algea', \1 ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->clear_unless_keys(bless({}, 'Test'), 'algea', \1)}
	);
};
subtest 'call_sub' => sub {
	plan tests => 4;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'call_sub' );
	eval { $obj->call_sub( [], 'limos', 'penthos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->call_sub([], 'limos', 'penthos')}
	);
	eval { $obj->call_sub( 'nosoi', 'limos', 'penthos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->call_sub('nosoi', 'limos', 'penthos')}
	);
};
subtest 'call_sub_my' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'call_sub_my' );
	eval { $obj->call_sub_my( [], 'curae', 'phobos', 'aporia' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->call_sub_my([], 'curae', 'phobos', 'aporia')}
	);
	eval { $obj->call_sub_my( 'geras', 'curae', 'phobos', 'aporia' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->call_sub_my( bless( {}, 'Test' ), \1, 'phobos', 'aporia' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->call_sub_my(bless({}, 'Test'), \1, 'phobos', 'aporia')}
	);
};
subtest 'delete' => sub {
	plan tests => 14;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'delete' );
	eval { $obj->delete( [], 'penthos', 'aporia', undef, undef, undef ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->delete([], 'penthos', 'aporia', undef, undef, undef)}
	);
	eval {
		$obj->delete( 'phobos', 'penthos', 'aporia', undef, undef, undef );

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	eval {
		$obj->delete( bless( {}, 'Test' ),
			'penthos', 'aporia', undef, undef, {} );
	};
	like( $@, qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->delete(bless({}, 'Test'), 'penthos', 'aporia', undef, undef, {})}
	);
};
subtest 'die_unless_keys' => sub {
	plan tests => 8;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'die_unless_keys' );
	eval { $obj->die_unless_keys( [], 'thanatos', 'hypnos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->die_unless_keys([], 'thanatos', 'hypnos')}
	);
	eval { $obj->die_unless_keys( 'limos', 'thanatos', 'hypnos' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->die_unless_keys( bless( {}, 'Test' ), 'thanatos', \1 ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->die_unless_keys(bless({}, 'Test'), 'thanatos', \1)}
	);
};
subtest 'else' => sub {
	plan tests => 4;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'else' );
	eval { $obj->else( [], 'algea' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->else([], 'algea')}
	);
	eval { $obj->else( 'phobos', 'algea' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->else('phobos', 'algea')}
	);
};
subtest 'elsif' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'elsif' );
	eval { $obj->elsif( [], 'phobos', 'phobos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->elsif([], 'phobos', 'phobos')}
	);
	eval { $obj->elsif( 'gaudia', 'phobos', 'phobos' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->elsif( bless( {}, 'Test' ), \1, 'phobos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->elsif(bless({}, 'Test'), \1, 'phobos')}
	);
};
subtest 'export' => sub {
	plan tests => 12;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'export' );
	eval { $obj->export( [], 'gaudia', 'nosoi', 10, 'hypnos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->export([], 'gaudia', 'nosoi', 10, 'hypnos')}
	);
	eval { $obj->export( 'geras', 'gaudia', 'nosoi', 10, 'hypnos' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->export( bless( {}, 'Test' ), 'gaudia', 'nosoi', 10, \1 ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->export(bless({}, 'Test'), 'gaudia', 'nosoi', 10, \1)}
	);
};
subtest 'for' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'for' );
	eval { $obj->for( [], 'aporia', 'curae' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->for([], 'aporia', 'curae')}
	);
	eval { $obj->for( 'algea', 'aporia', 'curae' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->for( bless( {}, 'Test' ), \1, 'curae' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->for(bless({}, 'Test'), \1, 'curae')}
	);
};
subtest 'foreach' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'foreach' );
	eval { $obj->foreach( [], 'aporia', 'geras' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->foreach([], 'aporia', 'geras')}
	);
	eval { $obj->foreach( 'penthos', 'aporia', 'geras' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->foreach( bless( {}, 'Test' ), \1, 'geras' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->foreach(bless({}, 'Test'), \1, 'geras')}
	);
};
subtest 'for_keys' => sub {
	plan tests => 8;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'for_keys' );
	eval { $obj->for_keys( [], 'hypnos', 'limos', 'thanatos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->for_keys([], 'hypnos', 'limos', 'thanatos')}
	);
	eval { $obj->for_keys( 'algea', 'hypnos', 'limos', 'thanatos' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->for_keys( bless( {}, 'Test' ), 'hypnos', \1, 'thanatos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->for_keys(bless({}, 'Test'), 'hypnos', \1, 'thanatos')}
	);
};
subtest 'for_key_exists_and_return' => sub {
	plan tests => 8;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'for_key_exists_and_return' );
	eval { $obj->for_key_exists_and_return( [], 'aporia', 'hypnos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->for_key_exists_and_return([], 'aporia', 'hypnos')}
	);
	eval { $obj->for_key_exists_and_return( 'gaudia', 'aporia', 'hypnos' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

		$obj->for_key_exists_and_return( bless( {}, 'Test' ), 'aporia', \1 );
	};
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->for_key_exists_and_return(bless({}, 'Test'), 'aporia', \1)}
	);
};
subtest 'grep' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'grep' );
	eval { $obj->grep( [], 'limos', 'phobos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->grep([], 'limos', 'phobos')}
	);
	eval { $obj->grep( 'limos', 'limos', 'phobos' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->grep( bless( {}, 'Test' ), \1, 'phobos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->grep(bless({}, 'Test'), \1, 'phobos')}
	);
};
subtest 'grep_map' => sub {
	plan tests => 8;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'grep_map' );
	eval { $obj->grep_map( [], 'phobos', 'gaudia', 'nosoi' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->grep_map([], 'phobos', 'gaudia', 'nosoi')}
	);
	eval { $obj->grep_map( 'nosoi', 'phobos', 'gaudia', 'nosoi' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->grep_map( bless( {}, 'Test' ), 'phobos', \1, 'nosoi' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->grep_map(bless({}, 'Test'), 'phobos', \1, 'nosoi')}
	);
};
subtest 'if' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'if' );
	eval { $obj->if( [], 'nosoi', 'phobos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->if([], 'nosoi', 'phobos')}
	);
	eval { $obj->if( 'curae', 'nosoi', 'phobos' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->if( bless( {}, 'Test' ), \1, 'phobos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->if(bless({}, 'Test'), \1, 'phobos')}
	);
};
subtest 'map' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'map' );
	eval { $obj->map( [], 'limos', 'hypnos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->map([], 'limos', 'hypnos')}
	);
	eval { $obj->map( 'curae', 'limos', 'hypnos' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->map( bless( {}, 'Test' ), \1, 'hypnos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->map(bless({}, 'Test'), \1, 'hypnos')}
	);
};
subtest 'map_grep' => sub {
	plan tests => 8;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'map_grep' );
	eval { $obj->map_grep( [], 'curae', 'nosoi', 'geras' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->map_grep([], 'curae', 'nosoi', 'geras')}
	);
	eval { $obj->map_grep( 'hypnos', 'curae', 'nosoi', 'geras' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->map_grep( bless( {}, 'Test' ), 'curae', \1, 'geras' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->map_grep(bless({}, 'Test'), 'curae', \1, 'geras')}
	);
};
subtest 'maybe' => sub {
	plan tests => 8;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'maybe' );
	eval { $obj->maybe( [], 'nosoi', 'phobos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->maybe([], 'nosoi', 'phobos')}
	);
	eval { $obj->maybe( 'curae', 'nosoi', 'phobos' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->maybe( bless( {}, 'Test' ), 'nosoi', \1 ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->maybe(bless({}, 'Test'), 'nosoi', \1)}
	);
};
subtest 'merge_hash_refs' => sub {
	plan tests => 4;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'merge_hash_refs' );
	eval { $obj->merge_hash_refs( [], 'gaudia' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->merge_hash_refs([], 'gaudia')}
	);
	eval { $obj->merge_hash_refs( 'thanatos', 'gaudia' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->merge_hash_refs('thanatos', 'gaudia')}
	);
};
subtest 'require' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'require' );
	eval { $obj->require( [], 'algea' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->require([], 'algea')}
	);
	eval { $obj->require( 'geras', 'algea' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->require( bless( {}, 'Test' ), \1 ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->require(bless({}, 'Test'), \1)}
	);
};
subtest 'unless' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'unless' );
	eval { $obj->unless( [], 'thanatos', 'nosoi' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->unless([], 'thanatos', 'nosoi')}
	);
	eval { $obj->unless( 'thanatos', 'thanatos', 'nosoi' ) };
	like(

t/Hades-Macro-Dolos.t  view on Meta::CPAN

	);
	eval { $obj->unless( bless( {}, 'Test' ), \1, 'nosoi' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->unless(bless({}, 'Test'), \1, 'nosoi')}
	);
};
subtest 'while' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::Dolos->new( {} ),
		q{my $obj = Hades::Macro::Dolos->new({})}
	);
	can_ok( $obj, 'while' );
	eval { $obj->while( [], 'curae', 'thanatos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->while([], 'curae', 'thanatos')}
	);
	eval { $obj->while( 'curae', 'curae', 'thanatos' ) };
	like(

t/Hades-Macro-FH.t  view on Meta::CPAN

use Test::More;
use strict;
use warnings;
our ( $sub, $globref );

BEGIN {
	use_ok('Hades::Macro::FH');
	$sub     = sub { };
	$globref = \*globref;
}
subtest 'new' => sub {
	plan tests => 9;
	ok( my $obj = Hades::Macro::FH->new( {} ),
		q{my $obj = Hades::Macro::FH->new({})}
	);
	ok( $obj = Hades::Macro::FH->new(), q{$obj = Hades::Macro::FH->new()} );
	isa_ok( $obj, 'Hades::Macro::FH' );
	ok( $obj = Hades::Macro::FH->new( {} ),
		q{$obj = Hades::Macro::FH->new({})}
	);
	ok( $obj = Hades::Macro::FH->new(), q{$obj = Hades::Macro::FH->new()} );
	is_deeply( $obj->macro,
		[qw/open_write open_read close_file read_file write_file/],
		q{$obj->macro} );
	ok( $obj = Hades::Macro::FH->new( { macro => ['test'] } ),
		q{$obj = Hades::Macro::FH->new({ macro => ['test'] })}
	);
	eval { $obj = Hades::Macro::FH->new( { macro => {} } ) };
	like(
		$@,
		qr/invalid|type|constraint|greater|atleast/i,
		q{$obj = Hades::Macro::FH->new({ macro => {} })}
	);
	eval { $obj = Hades::Macro::FH->new( { macro => 'hypnos' } ) };
	like(
		$@,
		qr/invalid|type|constraint|greater|atleast/i,
		q{$obj = Hades::Macro::FH->new({ macro => 'hypnos' })}
	);
};
subtest 'macro' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro::FH->new( {} ),
		q{my $obj = Hades::Macro::FH->new({})}
	);
	can_ok( $obj, 'macro' );
	is_deeply( $obj->macro( ['test'] ), ['test'], q{$obj->macro(['test'])} );
	eval { $obj->macro( {} ) };
	like( $@, qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->macro({})} );
	eval { $obj->macro('penthos') };
	like( $@, qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->macro('penthos')} );
	is_deeply( $obj->macro, ['test'], q{$obj->macro} );
};
subtest 'open_write' => sub {
	plan tests => 10;
	ok( my $obj = Hades::Macro::FH->new( {} ),
		q{my $obj = Hades::Macro::FH->new({})}
	);
	can_ok( $obj, 'open_write' );
	eval { $obj->open_write( [], 'nosoi', 'aporia', 'curae' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->open_write([], 'nosoi', 'aporia', 'curae')}
	);
	eval { $obj->open_write( 'aporia', 'nosoi', 'aporia', 'curae' ) };
	like(

t/Hades-Macro-FH.t  view on Meta::CPAN

	);
	eval { $obj->open_write( bless( {}, 'Test' ), 'nosoi', 'aporia', \1 ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->open_write(bless({}, 'Test'), 'nosoi', 'aporia', \1)}
	);
};
subtest 'open_read' => sub {
	plan tests => 10;
	ok( my $obj = Hades::Macro::FH->new( {} ),
		q{my $obj = Hades::Macro::FH->new({})}
	);
	can_ok( $obj, 'open_read' );
	eval { $obj->open_read( [], 'phobos', 'algea', 'penthos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->open_read([], 'phobos', 'algea', 'penthos')}
	);
	eval { $obj->open_read( 'nosoi', 'phobos', 'algea', 'penthos' ) };
	like(

t/Hades-Macro-FH.t  view on Meta::CPAN

	);
	eval { $obj->open_read( bless( {}, 'Test' ), 'phobos', 'algea', \1 ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->open_read(bless({}, 'Test'), 'phobos', 'algea', \1)}
	);
};
subtest 'close_file' => sub {
	plan tests => 8;
	ok( my $obj = Hades::Macro::FH->new( {} ),
		q{my $obj = Hades::Macro::FH->new({})}
	);
	can_ok( $obj, 'close_file' );
	eval { $obj->close_file( [], 'hypnos', 'limos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->close_file([], 'hypnos', 'limos')}
	);
	eval { $obj->close_file( 'algea', 'hypnos', 'limos' ) };
	like(

t/Hades-Macro-FH.t  view on Meta::CPAN

	);
	eval { $obj->close_file( bless( {}, 'Test' ), 'hypnos', \1 ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->close_file(bless({}, 'Test'), 'hypnos', \1)}
	);
};
subtest 'read_file' => sub {
	plan tests => 10;
	ok( my $obj = Hades::Macro::FH->new( {} ),
		q{my $obj = Hades::Macro::FH->new({})}
	);
	can_ok( $obj, 'read_file' );
	eval { $obj->read_file( [], 'algea', 'aporia', 'geras' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->read_file([], 'algea', 'aporia', 'geras')}
	);
	eval { $obj->read_file( 'penthos', 'algea', 'aporia', 'geras' ) };
	like(

t/Hades-Macro-FH.t  view on Meta::CPAN

	);
	eval { $obj->read_file( bless( {}, 'Test' ), 'algea', 'aporia', \1 ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->read_file(bless({}, 'Test'), 'algea', 'aporia', \1)}
	);
};
subtest 'write_file' => sub {
	plan tests => 12;
	ok( my $obj = Hades::Macro::FH->new( {} ),
		q{my $obj = Hades::Macro::FH->new({})}
	);
	can_ok( $obj, 'write_file' );
	eval { $obj->write_file( [], 'thanatos', 'geras', 'algea', 'penthos' ) };
	like(
		$@,
		qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->write_file([], 'thanatos', 'geras', 'algea', 'penthos')}
	);
	eval {
		$obj->write_file( 'geras', 'thanatos', 'geras', 'algea', 'penthos' );

t/Hades-Macro.t  view on Meta::CPAN

use Test::More;
use strict;
use warnings;
our ( $sub, $globref );

BEGIN {
	use_ok('Hades::Macro');
	$sub     = sub { };
	$globref = \*globref;
}
subtest 'new' => sub {
	plan tests => 14;
	ok( my $obj = Hades::Macro->new( {} ),
		q{my $obj = Hades::Macro->new({})}
	);
	ok( $obj = Hades::Macro->new(), q{$obj = Hades::Macro->new()} );
	isa_ok( $obj, 'Hades::Macro' );
	ok( $obj = Hades::Macro->new(
			{ alias => { test => ['test'] }, macro => ['test'] }
		),
		q{$obj = Hades::Macro->new({ alias => { test => ['test'] }, macro => ['test'] })}
	);
	eval {
		$obj = Hades::Macro->new(
			{ alias => { test => {} }, macro => ['test'] } );
	};
	like( $@, qr/invalid|type|constraint|greater|atleast/i,
		q{$obj = Hades::Macro->new({ alias => { test => {} }, macro => ['test'] })}
	);
	eval {
		$obj = Hades::Macro->new(
			{ alias => { test => 'aporia' }, macro => ['test'] } );
	};
	like( $@, qr/invalid|type|constraint|greater|atleast/i,
		q{$obj = Hades::Macro->new({ alias => { test => 'aporia' }, macro => ['test'] })}
	);
	eval {
		$obj = Hades::Macro->new(
			{ alias => { test => undef }, macro => ['test'] } );
	};
	like( $@, qr/invalid|type|constraint|greater|atleast/i,
		q{$obj = Hades::Macro->new({ alias => { test => undef }, macro => ['test'] })}
	);
	eval { $obj = Hades::Macro->new( { alias => [], macro => ['test'] } ) };
	like(
		$@,
		qr/invalid|type|constraint|greater|atleast/i,
		q{$obj = Hades::Macro->new({ alias => [], macro => ['test'] })}
	);
	eval {
		$obj = Hades::Macro->new( { alias => 'phobos', macro => ['test'] } );
	};
	like( $@, qr/invalid|type|constraint|greater|atleast/i,
		q{$obj = Hades::Macro->new({ alias => 'phobos', macro => ['test'] })}
	);
	ok( $obj = Hades::Macro->new( { alias => { test => ['test'] } } ),
		q{$obj = Hades::Macro->new({alias => { test => ['test'] }})}
	);
	ok( $obj = Hades::Macro->new( alias => { test => ['test'] } ),
		q{$obj = Hades::Macro->new(alias => { test => ['test'] })}
	);
	is_deeply( $obj->macro, [], q{$obj->macro} );
	eval {
		$obj = Hades::Macro->new(
			{ alias => { test => ['test'] }, macro => {} } );
	};
	like( $@, qr/invalid|type|constraint|greater|atleast/i,
		q{$obj = Hades::Macro->new({ alias => { test => ['test'] }, macro => {} })}
	);
	eval {
		$obj = Hades::Macro->new(
			{ alias => { test => ['test'] }, macro => 'algea' } );
	};
	like( $@, qr/invalid|type|constraint|greater|atleast/i,
		q{$obj = Hades::Macro->new({ alias => { test => ['test'] }, macro => 'algea' })}
	);
};
subtest 'macro' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro->new( {} ),
		q{my $obj = Hades::Macro->new({})}
	);
	can_ok( $obj, 'macro' );
	is_deeply( $obj->macro( ['test'] ), ['test'], q{$obj->macro(['test'])} );
	eval { $obj->macro( {} ) };
	like( $@, qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->macro({})} );
	eval { $obj->macro('gaudia') };
	like( $@, qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->macro('gaudia')} );
	is_deeply( $obj->macro, ['test'], q{$obj->macro} );
};
subtest 'alias' => sub {
	plan tests => 10;
	ok( my $obj = Hades::Macro->new( {} ),
		q{my $obj = Hades::Macro->new({})}
	);
	can_ok( $obj, 'alias' );
	is( $obj->alias, undef, q{$obj->alias} );
	is_deeply(
		$obj->alias( { test => ['test'] } ),
		{ test => ['test'] },
		q{$obj->alias({ test => ['test'] })}
	);
	eval { $obj->alias( { test => {} } ) };
	like(

t/Hades-Macro.t  view on Meta::CPAN

	eval { $obj->alias( [] ) };
	like( $@, qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->alias([])} );
	eval { $obj->alias('hypnos') };
	like( $@, qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->alias('hypnos')} );
	is_deeply( $obj->alias, { test => ['test'] }, q{$obj->alias} );
};
subtest 'has_alias' => sub {
	plan tests => 6;
	ok( my $obj = Hades::Macro->new( {} ),
		q{my $obj = Hades::Macro->new({})}
	);
	can_ok( $obj, 'has_alias' );
	ok( do { delete $obj->{alias}; 1; }, q{do{ delete $obj->{alias}; 1;}} );
	is( $obj->has_alias, '', q{$obj->has_alias} );
	is_deeply(
		$obj->alias( { test => ['test'] } ),
		{ test => ['test'] },
		q{$obj->alias({ test => ['test'] })}
	);
	is( $obj->has_alias, 1, q{$obj->has_alias} );
};
subtest 'meta' => sub {
	plan tests => 4;
	ok( my $obj = Hades::Macro->new( {} ),
		q{my $obj = Hades::Macro->new({})}
	);
	can_ok( $obj, 'meta' );
	eval { $obj->meta( [] ) };
	like( $@, qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->meta([])} );
	eval { $obj->meta('nosoi') };
	like( $@, qr/invalid|value|type|constraint|greater|atleast/i,
		q{$obj->meta('nosoi')} );
};
done_testing();



( run in 1.052 second using v1.01-cache-2.11-cpan-49f99fa48dc )