In perl.git, the branch blead-next has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/ac67107de7babf74553d5a06dab980600af790bf?hp=b27341ccd97864c72a4fea418ad1222a824bed66>

- Log -----------------------------------------------------------------
commit ac67107de7babf74553d5a06dab980600af790bf
Author: Dagfinn Ilmari MannsÃ¥ker <[email protected]>
Date:   Wed May 31 16:53:42 2017 +0100

    Move :unique test into it own file so it can be skipped separately
    
    Merely parsing an unknown attribute fails, so the skip has to happen
    at BEGIN time.
-----------------------------------------------------------------------

Summary of changes:
 dist/threads/t/problems.t | 52 ++----------------------------
 dist/threads/t/unique.t   | 81 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 83 insertions(+), 50 deletions(-)
 create mode 100644 dist/threads/t/unique.t

diff --git a/dist/threads/t/problems.t b/dist/threads/t/problems.t
index 3f28c0f3b5..3657d3403e 100644
--- a/dist/threads/t/problems.t
+++ b/dist/threads/t/problems.t
@@ -21,18 +21,14 @@ BEGIN {
 
     $| = 1;
     if ($] == 5.008) {
-        print("1..11\n");   ### Number of tests that will be run ###
+        print("1..6\n");    ### Number of tests that will be run ###
     } else {
-        print("1..15\n");   ### Number of tests that will be run ###
+        print("1..10\n");   ### Number of tests that will be run ###
     }
 };
 
 print("ok 1 - Loaded\n");
 
-### Start of Testing ###
-
-no warnings 'deprecated';       # Suppress warnings related to :unique
-
 use Hash::Util 'lock_keys';
 
 my $test :shared = 2;
@@ -93,50 +89,6 @@ if ($] != 5.008)
 }
 
 
-# bugid 24383 - :unique hashes weren't being made readonly on interpreter
-# clone; check that they are.
-
-our $unique_scalar : unique;
-our @unique_array : unique;
-our %unique_hash : unique;
-threads->create(sub {
-        lock($test);
-        my $TODO = ":unique needs to be re-implemented in a non-broken way";
-        eval { $unique_scalar = 1 };
-        print $@ =~ /read-only/
-          ? '' : 'not ', "ok $test # TODO $TODO - unique_scalar\n";
-        $test++;
-        eval { $unique_array[0] = 1 };
-        print $@ =~ /read-only/
-          ? '' : 'not ', "ok $test # TODO $TODO - unique_array\n";
-        $test++;
-        if ($] >= 5.008003 && $^O ne 'MSWin32') {
-            eval { $unique_hash{abc} = 1 };
-            print $@ =~ /disallowed/
-              ? '' : 'not ', "ok $test # TODO $TODO - unique_hash\n";
-        } else {
-            print("ok $test # SKIP $TODO - unique_hash\n");
-        }
-        $test++;
-    })->join;
-
-# bugid #24940 :unique should fail on my and sub declarations
-
-for my $decl ('my $x : unique', 'sub foo : unique') {
-    {
-        lock($test);
-        if ($] >= 5.008005) {
-            eval $decl;
-            print $@ =~ /^The 'unique' attribute may only be applied to 'our' 
variables/
-                    ? '' : 'not ', "ok $test - $decl\n";
-        } else {
-            print("ok $test # SKIP $decl\n");
-        }
-        $test++;
-    }
-}
-
-
 # Returning a closure from a thread caused problems. If the last index in
 # the anon sub's pad wasn't for a lexical, then a core dump could occur.
 # Otherwise, there might be leaked scalars.
diff --git a/dist/threads/t/unique.t b/dist/threads/t/unique.t
new file mode 100644
index 0000000000..a9cfdbbcd2
--- /dev/null
+++ b/dist/threads/t/unique.t
@@ -0,0 +1,81 @@
+use strict;
+use warnings;
+
+BEGIN {
+    use Config;
+    if (! $Config{'useithreads'}) {
+        print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
+        exit(0);
+    }
+    if ($] >= 5.027000) {
+        print("1..0 # SKIP 'unique' attribute no longer exists\n");
+        exit(0);
+    }
+}
+
+use ExtUtils::testlib;
+
+use threads;
+
+BEGIN {
+    if (! eval 'use threads::shared; 1') {
+        print("1..0 # SKIP threads::shared not available\n");
+        exit(0);
+    }
+
+    $| = 1;
+    print("1..6\n") ;           ### Number of tests that will be run ###
+}
+
+print("ok 1 - Loaded\n");
+
+### Start of Testing ###
+
+no warnings 'deprecated';       # Suppress warnings related to :unique
+
+my $test :shared = 2;
+
+# bugid 24383 - :unique hashes weren't being made readonly on interpreter
+# clone; check that they are.
+
+our $unique_scalar : unique;
+our @unique_array : unique;
+our %unique_hash : unique;
+threads->create(sub {
+        lock($test);
+        my $TODO = ":unique needs to be re-implemented in a non-broken way";
+        eval { $unique_scalar = 1 };
+        print $@ =~ /read-only/
+          ? '' : 'not ', "ok $test # TODO $TODO - unique_scalar\n";
+        $test++;
+        eval { $unique_array[0] = 1 };
+        print $@ =~ /read-only/
+          ? '' : 'not ', "ok $test # TODO $TODO - unique_array\n";
+        $test++;
+        if ($] >= 5.008003 && $^O ne 'MSWin32') {
+            eval { $unique_hash{abc} = 1 };
+            print $@ =~ /disallowed/
+              ? '' : 'not ', "ok $test # TODO $TODO - unique_hash\n";
+        } else {
+            print("ok $test # SKIP $TODO - unique_hash\n");
+        }
+        $test++;
+    })->join;
+
+# bugid #24940 :unique should fail on my and sub declarations
+
+for my $decl ('my $x : unique', 'sub foo : unique') {
+    {
+        lock($test);
+        if ($] >= 5.008005) {
+            eval $decl;
+            print $@ =~ /^The 'unique' attribute may only be applied to 'our' 
variables/
+                    ? '' : 'not ', "ok $test - $decl\n";
+        } else {
+            print("ok $test # SKIP $decl\n");
+        }
+        $test++;
+    }
+}
+
+

--
Perl5 Master Repository

Reply via email to