STL files can have blank lines and comments now.
authorShawn Boyette <sboyette@esilibrary.com>
Thu, 26 Mar 2009 20:45:05 +0000 (20:45 +0000)
committerShawn Boyette <sboyette@esilibrary.com>
Thu, 26 Mar 2009 20:45:05 +0000 (20:45 +0000)
Equinox-Migration/lib/Equinox/Migration/SimpleTagList.pm
Equinox-Migration/t/01-SimpleTagList.t
Equinox-Migration/t/corpus/stl-0.txt

index 6bac8df..c596d06 100644 (file)
@@ -109,12 +109,16 @@ sub generate {
 
     open TAGFILE, '<', $self->{conf}{file};
     while (<TAGFILE>) {
+        next if m/^#/;
+        next if m/^\s*\n$/;
+
         $self->{conf}{lastwasrange} = 0;
         $self->{conf}{range}{high}  = 0;
         $self->{conf}{range}{low}   = 0;
 
         my @chunks = split /\s+/;
         while (my $chunk = shift @chunks) {
+            last if ($chunk =~ /^#/);
 
             # single values
             if ($chunk =~ /^\d{1,3}$/) {
index b1dc3bd..69a1994 100644 (file)
@@ -1,6 +1,6 @@
 #!perl -T
 
-use Test::More tests => 49;
+use Test::More tests => 51;
 #use Test::More qw(no_plan);
 
 use Equinox::Migration::SimpleTagList;
@@ -65,11 +65,13 @@ is ($stl->has(652), 1);
 is ($stl->has(654), 1);
 is ($stl->has(656), 1);
 is ($stl->has(658), 1);
+is ($stl->has(797), 1, 'exception is inline commented out');
 is ($stl->has(872), 1);
 is ($stl->has(900), 1);
 is ($stl->has(999), 1);
 is ($stl->has(988), 1);
 is ($stl->has(411), 0, 'exception');
+is ($stl->has(500), 0, 'inclusion commented out');
 is ($stl->has(655), 0, 'exception');
 is ($stl->has(915), 0, 'exception');
 is ($stl->has(987), 0, 'exception');
index abc0189..848ec77 100644 (file)
@@ -1,8 +1,11 @@
+# comments and blank lines are ok now!
+
 011 012 016 061 069 071 096 098
 212 214 241 263
 350 359
 400..450 except 410..415
+# 500..599
 652..658 except 655 696..699
-720 755 796..799
+720 755 796..799 # except 797
 850 852 870..879 886 890 896..899
 900..999 except 910..920 except 935 except 987 except 994