FAQ
In perl.git, the branch sprout/mywack has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/d4df10886b190e8474bce740efd8b9b3ae2def80?hp=4ffb6d5991dd1c33e0a67050ff06bc476c2074fb>

- Log -----------------------------------------------------------------
commit d4df10886b190e8474bce740efd8b9b3ae2def80
Author: Father Chrysostomos <sprout@cpan.org>
Date: Sun May 29 20:11:08 2016 -0700

     Tests for declared_refs err/warn messages

M MANIFEST
A t/op/decl-refs.t

commit 4029d2e81422d4e3500b51cfd52062b3ddcd681c
Author: Father Chrysostomos <sprout@cpan.org>
Date: Sun May 29 18:40:07 2016 -0700

     fixup for ‘Allow my \$a’

M op.c
-----------------------------------------------------------------------

Summary of changes:
  MANIFEST | 1 +
  op.c | 1 +
  t/op/decl-refs.t | 37 +++++++++++++++++++++++++++++++++++++
  3 files changed, 39 insertions(+)
  create mode 100644 t/op/decl-refs.t

diff --git a/MANIFEST b/MANIFEST
index cb53872..4a6ce8f 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5346,6 +5346,7 @@ t/op/cproto.t Check builtin prototypes
  t/op/crypt.t See if crypt works
  t/op/current_sub.t __SUB__ tests
  t/op/dbm.t See if dbmopen/dbmclose work
+t/op/decl-refs.t See if my \$foo works
  t/op/defined.t See if defined() edge cases work
  t/op/defins.t See if auto-insert of defined() works
  t/op/delete.t See if delete works
diff --git a/op.c b/op.c
index e3e0a89..50757e2 100644
--- a/op.c
+++ b/op.c
@@ -3707,6 +3707,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp)
       "Declaring references is experimental");
   /* Kid is a nulled OP_LIST, handled above. */
   my_kid(cUNOPo->op_first, attrs, imopsp);
+ return o;
      }
      else if (type != OP_PADSV &&
        type != OP_PADAV &&
diff --git a/t/op/decl-refs.t b/t/op/decl-refs.t
new file mode 100644
index 0000000..1da0f9d
--- /dev/null
+++ b/t/op/decl-refs.t
@@ -0,0 +1,37 @@
+BEGIN {
+ chdir 't';
+ require './test.pl';
+ set_up_inc('../lib');
+}
+
+plan 108;
+
+for my $decl (qw< my CORE::state our local >) {
+ for my $funny (qw< $ @ % >) {
+ # Test three syntaxes with each declarator/funny char combination:
+ # my \$foo my(\$foo) my\($foo)
+
+ for my $code("$decl \\${funny}x", "$decl\(\\${funny}x\)",
+ "$decl\\\(${funny}x\)") {
+ eval $code;
+ like
+ $@,
+ qr/^The experimental declared_refs feature is not enabled/,
+ "$code error when feature is disabled";
+
+ use feature 'declared_refs';
+
+ my($w,$c);
+ local $SIG{__WARN__} = sub { $c++; $w = shift };
+ eval $code;
+ is $c, 1, "one warning from $code";
+ like $w, qr/^Declaring references is experimental at /,
+ "experimental warning for $code";
+ }
+ }
+}
+
+use feature 'declared_refs', 'state';
+no warnings 'experimental::declared_refs';
+
+# The rest of the tests go here....

--
Perl5 Master Repository

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl5-changes @
categoriesperl
postedMay 30, '16 at 3:12a
activeMay 30, '16 at 3:12a
posts1
users1
websiteperl.org

1 user in discussion

Father Chrysostomos: 1 post

People

Translate

site design / logo © 2018 Grokbase