From f3f1703187556e900e3b1b5e0f00ef8cce14da52 Mon Sep 17 00:00:00 2001 From: Shawn Boyette Date: Thu, 26 Mar 2009 20:45:05 +0000 Subject: [PATCH] STL files can have blank lines and comments now. --- .../lib/Equinox/Migration/SimpleTagList.pm | 4 ++++ Equinox-Migration/t/01-SimpleTagList.t | 4 +++- Equinox-Migration/t/corpus/stl-0.txt | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Equinox-Migration/lib/Equinox/Migration/SimpleTagList.pm b/Equinox-Migration/lib/Equinox/Migration/SimpleTagList.pm index 6bac8df..c596d06 100644 --- a/Equinox-Migration/lib/Equinox/Migration/SimpleTagList.pm +++ b/Equinox-Migration/lib/Equinox/Migration/SimpleTagList.pm @@ -109,12 +109,16 @@ sub generate { open TAGFILE, '<', $self->{conf}{file}; while () { + 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}$/) { diff --git a/Equinox-Migration/t/01-SimpleTagList.t b/Equinox-Migration/t/01-SimpleTagList.t index b1dc3bd..69a1994 100644 --- a/Equinox-Migration/t/01-SimpleTagList.t +++ b/Equinox-Migration/t/01-SimpleTagList.t @@ -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'); diff --git a/Equinox-Migration/t/corpus/stl-0.txt b/Equinox-Migration/t/corpus/stl-0.txt index abc0189..848ec77 100644 --- a/Equinox-Migration/t/corpus/stl-0.txt +++ b/Equinox-Migration/t/corpus/stl-0.txt @@ -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 -- 1.7.2.5