This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Allow package name in ‘use constant’ constants
[perl5.git] / dist / constant / t / constant.t
index 159e217..00eddfb 100644 (file)
@@ -9,7 +9,7 @@ END { @warnings && print STDERR join "\n- ", "accumulated warnings:", @warnings
 
 
 use strict;
-use Test::More tests => 105;
+use Test::More tests => 109;
 my $TB = Test::More->builder;
 
 BEGIN { use_ok('constant'); }
@@ -414,3 +414,10 @@ SKIP: {
     is $values[1], $values[0],
        'modifying list const elements does not affect future retavls';
 }
+
+use constant { "tahi" => 1, "rua::rua" => 2, "toru'toru" => 3 };
+use constant "wha::wha" => 4;
+is tahi, 1, 'unqualified constant declared with constants in other pkgs';
+is rua::rua, 2, 'constant declared with ::';
+is toru::toru, 3, "constant declared with '";
+is wha::wha, 4, 'constant declared by itself with ::';