This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Get override.t working under minitest
[perl5.git] / t / op / override.t
index 15afb05..31889a4 100644 (file)
@@ -2,13 +2,14 @@
 
 BEGIN {
     chdir 't' if -d 't';
-    @INC = '../lib';
     require './test.pl';
+    @INC = () unless is_miniperl();
+    unshift @INC, qw '../lib ../cpan/Text-ParseWords/lib';
     require Config; # load these before we mess with *CORE::GLOBAL::require
     require 'Config_heavy.pl'; # since runperl will need them
 }
 
-plan tests => 33;
+plan tests => 35;
 
 #
 # This file tries to test builtin override using CORE::GLOBAL
@@ -169,3 +170,16 @@ like runperl(prog => 'use constant foo=>1; '
              stderr => 1),
      qr/Too many arguments/,
     '`` does not ignore &CORE::GLOBAL::readpipe aliased to a constant';
+like runperl(prog => 'use constant foo=>1; '
+                    .'BEGIN { *{q|CORE::GLOBAL::readline|} = \&{q|foo|};1}'
+                    .'warn <a>',
+             stderr => 1),
+     qr/Too many arguments/,
+    '<> does not ignore &CORE::GLOBAL::readline aliased to a constant';
+
+is runperl(prog => 'use constant t=>42; '
+                  .'BEGIN { *{q|CORE::GLOBAL::time|} = \&{q|t|};1}'
+                  .'print time, chr 10',
+          stderr => 1),
+   "42\n",
+   'keywords respect global constant overrides';