skip subtests if Test::More is too old
[perl/list-index.git] / t / 10-ranges.t
index 3a465b83eddec8950eab27790d12dc7be1660de2..9befbb68160ca850f17e33685e3ade61e7a10812 100644 (file)
@@ -9,7 +9,14 @@ use Data::Dump 'pp';
 BEGIN { use_ok('List::Index'); }
 ok(eval { List::Index->VERSION(1) }, 'version 1.00 compatibility');
 
-subtest 'single-char alphabet' => sub {
+eval { Test::More->VERSION(0.93) } or eval q{
+       diag "Install Test::More v0.93 to run subtests\n";
+       sub subtest {
+               SKIP: { skip 'subtest', 1; }
+       }
+};
+
+subtest('single-char alphabet' => sub {
        plan tests => 5;
        my @data = ('a'..'z');
 
@@ -30,9 +37,9 @@ subtest 'single-char alphabet' => sub {
                ['-a', 'b'..'y', 'z-'],
                'max pages'
        );
-};
+});
 
-subtest 'uniform alphanumeric' => sub {
+subtest('uniform alphanumeric' => sub {
        plan tests => 2;
        my @data = ('aa'..'zz', 1..202);
        my $index = List::Index->new or return;
@@ -50,9 +57,9 @@ subtest 'uniform alphanumeric' => sub {
                [qw(-c d-n o-)],
                'large pagesize'
        );
-};
+});
 
-subtest 'context' => sub {
+subtest('context' => sub {
        plan tests => 9;
        my @data = qw(
                kkeg kl km kmlu knsy    koxb kpeo kuaa kuab kuac
@@ -118,9 +125,9 @@ subtest 'context' => sub {
                [qw(-k l-)],
                'full overlap'
        );
-};
+});
 
-subtest 'distribution' => sub {
+subtest('distribution' => sub {
        plan tests => 2;
        my @data = qw(
                gnihka gniub go gsearnrqns gtdvcxyt gw gwoufolwcvmtueyg gysgphci h habkdgifjfxoh
@@ -144,9 +151,9 @@ subtest 'distribution' => sub {
        # page #14 [gn-g] (8): gnihka gniub go gsearnrqns gtdvcxyt gwawkvmueovdjtfj gwoufolwcvmtueyg gysgphci
        # page #15 [h] (17): h habkdgifjfxoh hbbvjf hbqleexnqts hccgszftbaymfu hdaqzkow hdoeqwdmgqwaoya hfbegicieu hfmlpzzioqjbthz hj hkoysmws hmylu hnvtvpievbdlkrmb hsodfpkatk hvdvcqn hvn hyrybeurqtevjfmi
        # page #16 [i-ie] (5): i iaab ibiavqyar idfniqvxpohbk idh
-};
+});
 
-subtest 'modulo' => sub {
+subtest('modulo' => sub {
        plan tests => 2;
        my @data = qw( a b ccb   ccd  cce gf ggg   ggh  i j );
        my $index = List::Index->new({ pagesize => 4, context => 0 }) or return;
@@ -163,9 +170,9 @@ subtest 'modulo' => sub {
                [qw(-b c-gf gg-)],
                'context at new intervals'
        );
-};
+});
 
-subtest 'corner cases' => sub {
+subtest('corner cases' => sub {
        plan tests => 1;
 
        is_deeply(
@@ -173,9 +180,9 @@ subtest 'corner cases' => sub {
                ['-'],
                '2 rows 1 page'
        );
-};
+});
 
-subtest 'context' => sub {
+subtest('context' => sub {
        plan tests => 4;
        my @data = qw( baa1 baa2  baa3 baaa  bbc cbc  daaa ea  eaaa zed );
        my $index = List::Index->new({ pagesize => 2 }) or return;
@@ -203,5 +210,5 @@ subtest 'context' => sub {
        );
 
        #pp(List::Index->new({pagesize => 2, context => 2, length => 1}))->ranges(\@data);
-};
+});