summaryrefslogtreecommitdiff
path: root/t/20-modules/Type-Library
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2023-01-02 12:38:52 +0100
committerJonas Smedegaard <dr@jones.dk>2023-01-02 12:38:52 +0100
commita38b05357b20ef15ca83800e28f1fb44e6c6b87b (patch)
tree14d7988daaf185faee2d37857b4bfd37448b3006 /t/20-modules/Type-Library
parent1e2074ab6e5a2b953591c5c912e23cedffea8402 (diff)
parent5bdc3f3302539003af87a9149b3e8b4dcd3ec626 (diff)
New upstream version 2.002000
Diffstat (limited to 't/20-modules/Type-Library')
-rw-r--r--t/20-modules/Type-Library/assert.t2
-rw-r--r--t/20-modules/Type-Library/declared-types.t2
-rw-r--r--t/20-modules/Type-Library/deprecation.t2
-rw-r--r--t/20-modules/Type-Library/errors.t2
-rw-r--r--t/20-modules/Type-Library/exportables-duplicated.t45
-rw-r--r--t/20-modules/Type-Library/exportables.t2
-rw-r--r--t/20-modules/Type-Library/import-params.t2
-rw-r--r--t/20-modules/Type-Library/inheritance.t2
-rw-r--r--t/20-modules/Type-Library/is.t2
-rw-r--r--t/20-modules/Type-Library/own-registry.t2
-rw-r--r--t/20-modules/Type-Library/recursive-type-definitions.t2
-rw-r--r--t/20-modules/Type-Library/remove-type.t50
-rw-r--r--t/20-modules/Type-Library/to.t2
-rw-r--r--t/20-modules/Type-Library/types.t2
14 files changed, 107 insertions, 12 deletions
diff --git a/t/20-modules/Type-Library/assert.t b/t/20-modules/Type-Library/assert.t
index f9415c4b..f9e3d87e 100644
--- a/t/20-modules/Type-Library/assert.t
+++ b/t/20-modules/Type-Library/assert.t
@@ -16,7 +16,7 @@ Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
-This software is copyright (c) 2013-2014, 2017-2022 by Toby Inkster.
+This software is copyright (c) 2013-2014, 2017-2023 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.
diff --git a/t/20-modules/Type-Library/declared-types.t b/t/20-modules/Type-Library/declared-types.t
index 6fc4a36e..7e327b56 100644
--- a/t/20-modules/Type-Library/declared-types.t
+++ b/t/20-modules/Type-Library/declared-types.t
@@ -12,7 +12,7 @@ Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
-This software is copyright (c) 2020-2022 by Toby Inkster.
+This software is copyright (c) 2020-2023 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.
diff --git a/t/20-modules/Type-Library/deprecation.t b/t/20-modules/Type-Library/deprecation.t
index 3a074624..39ac7f39 100644
--- a/t/20-modules/Type-Library/deprecation.t
+++ b/t/20-modules/Type-Library/deprecation.t
@@ -12,7 +12,7 @@ Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
-This software is copyright (c) 2018-2022 by Toby Inkster.
+This software is copyright (c) 2018-2023 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.
diff --git a/t/20-modules/Type-Library/errors.t b/t/20-modules/Type-Library/errors.t
index cade3da6..c414018b 100644
--- a/t/20-modules/Type-Library/errors.t
+++ b/t/20-modules/Type-Library/errors.t
@@ -12,7 +12,7 @@ Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
-This software is copyright (c) 2013-2014, 2017-2022 by Toby Inkster.
+This software is copyright (c) 2013-2014, 2017-2023 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.
diff --git a/t/20-modules/Type-Library/exportables-duplicated.t b/t/20-modules/Type-Library/exportables-duplicated.t
new file mode 100644
index 00000000..1e95d3a1
--- /dev/null
+++ b/t/20-modules/Type-Library/exportables-duplicated.t
@@ -0,0 +1,45 @@
+=pod
+
+=encoding utf-8
+
+=head1 PURPOSE
+
+Tests type libraries can detect two types trying to export the same functions.
+
+=head1 AUTHOR
+
+Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
+
+=head1 COPYRIGHT AND LICENCE
+
+This software is copyright (c) 2022-2023 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.
+
+=cut
+
+use strict;
+use warnings;
+
+use Test::More;
+
+my $e = do {
+ package My::Types;
+ use Type::Library -base, -utils;
+
+ # This should create constants ABC_DEF_GHI and ABC_DEF_JKL
+ enum( 'Abc_Def', [qw/ ghi jkl /] );
+
+ local $@;
+ eval {
+ # This should also create constant ABC_DEF_GHI
+ enum( 'Abc', [qw/ def_ghi /] );
+ 1;
+ };
+ $@;
+};
+
+like $e, qr/Function ABC_DEF_GHI is provided by types Abc_Def and Abc/;
+
+done_testing;
diff --git a/t/20-modules/Type-Library/exportables.t b/t/20-modules/Type-Library/exportables.t
index 051ffc9b..2d0e7f44 100644
--- a/t/20-modules/Type-Library/exportables.t
+++ b/t/20-modules/Type-Library/exportables.t
@@ -12,7 +12,7 @@ Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
-This software is copyright (c) 2022 by Toby Inkster.
+This software is copyright (c) 2022-2023 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.
diff --git a/t/20-modules/Type-Library/import-params.t b/t/20-modules/Type-Library/import-params.t
index 4ff9db4f..b58fbca1 100644
--- a/t/20-modules/Type-Library/import-params.t
+++ b/t/20-modules/Type-Library/import-params.t
@@ -12,7 +12,7 @@ Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
-This software is copyright (c) 2019-2022 by Toby Inkster.
+This software is copyright (c) 2019-2023 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.
diff --git a/t/20-modules/Type-Library/inheritance.t b/t/20-modules/Type-Library/inheritance.t
index 0c541912..94a4e9e4 100644
--- a/t/20-modules/Type-Library/inheritance.t
+++ b/t/20-modules/Type-Library/inheritance.t
@@ -12,7 +12,7 @@ Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
-This software is copyright (c) 2013-2014, 2017-2022 by Toby Inkster.
+This software is copyright (c) 2013-2014, 2017-2023 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.
diff --git a/t/20-modules/Type-Library/is.t b/t/20-modules/Type-Library/is.t
index 0a28d80b..d9b8c8b7 100644
--- a/t/20-modules/Type-Library/is.t
+++ b/t/20-modules/Type-Library/is.t
@@ -16,7 +16,7 @@ Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
-This software is copyright (c) 2013-2014, 2017-2022 by Toby Inkster.
+This software is copyright (c) 2013-2014, 2017-2023 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.
diff --git a/t/20-modules/Type-Library/own-registry.t b/t/20-modules/Type-Library/own-registry.t
index beffc898..ae659930 100644
--- a/t/20-modules/Type-Library/own-registry.t
+++ b/t/20-modules/Type-Library/own-registry.t
@@ -12,7 +12,7 @@ Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
-This software is copyright (c) 2022 by Toby Inkster.
+This software is copyright (c) 2022-2023 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.
diff --git a/t/20-modules/Type-Library/recursive-type-definitions.t b/t/20-modules/Type-Library/recursive-type-definitions.t
index a522c7ba..b114f1ca 100644
--- a/t/20-modules/Type-Library/recursive-type-definitions.t
+++ b/t/20-modules/Type-Library/recursive-type-definitions.t
@@ -12,7 +12,7 @@ Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
-This software is copyright (c) 2020-2022 by Toby Inkster.
+This software is copyright (c) 2020-2023 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.
diff --git a/t/20-modules/Type-Library/remove-type.t b/t/20-modules/Type-Library/remove-type.t
new file mode 100644
index 00000000..638345b3
--- /dev/null
+++ b/t/20-modules/Type-Library/remove-type.t
@@ -0,0 +1,50 @@
+=pod
+
+=encoding utf-8
+
+=head1 PURPOSE
+
+Tests Type::Library's hidden C<_remove_type> method.
+
+=head1 AUTHOR
+
+Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
+
+=head1 COPYRIGHT AND LICENCE
+
+This software is copyright (c) 2022-2023 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.
+
+=cut
+
+use strict;
+use warnings;
+use Test::Requires 'namespace::clean';
+use Test::More;
+
+use Types::Standard ();
+
+# hack
+delete( Types::Standard->meta->{immutable} );
+
+# do it!
+Types::Standard->_remove_type( Types::Standard::Str() );
+
+ok !Types::Standard->can('Str');
+ok !Types::Standard->can('is_Str');
+ok !Types::Standard->can('assert_Str');
+ok !Types::Standard->can('to_Str');
+
+my %h;
+Types::Standard->import( { into => \%h } );
+
+ok !exists $h{Str};
+ok !exists $h{is_Str};
+ok !exists $h{assert_Str};
+ok !exists $h{to_Str};
+
+ok eval 'use Types::Standard -all; 1';
+
+done_testing;
diff --git a/t/20-modules/Type-Library/to.t b/t/20-modules/Type-Library/to.t
index 0fc647b4..73630678 100644
--- a/t/20-modules/Type-Library/to.t
+++ b/t/20-modules/Type-Library/to.t
@@ -16,7 +16,7 @@ Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
-This software is copyright (c) 2013-2014, 2017-2022 by Toby Inkster.
+This software is copyright (c) 2013-2014, 2017-2023 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.
diff --git a/t/20-modules/Type-Library/types.t b/t/20-modules/Type-Library/types.t
index 1a1cd0f3..0be94255 100644
--- a/t/20-modules/Type-Library/types.t
+++ b/t/20-modules/Type-Library/types.t
@@ -16,7 +16,7 @@ Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
-This software is copyright (c) 2013-2014, 2017-2022 by Toby Inkster.
+This software is copyright (c) 2013-2014, 2017-2023 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.