version 1.1, 2003/11/25 12:12:34
|
version 1.3, 2003/12/02 12:12:16
|
Line 43 use ConfigFileEdit;
|
Line 43 use ConfigFileEdit;
|
# from the middle. |
# from the middle. |
# |
# |
|
|
BEGIN {plan tests => 6} |
BEGIN {plan tests => 8} |
|
|
# |
# |
# Test deletion of middle element. |
# Test deletion of middle element. |
Line 57 sub TestDeleteMiddle {
|
Line 57 sub TestDeleteMiddle {
|
my $editor = ConfigFileEdit->new("test2config.cfg", 0); |
my $editor = ConfigFileEdit->new("test2config.cfg", 0); |
|
|
my $linecount = $editor->LineCount(); |
my $linecount = $editor->LineCount(); |
|
my $hashref = $editor->{KeyToLines}; |
|
my $initiallast = $hashref->{"last"}; |
|
|
$editor->DeleteLine("line2"); |
$editor->DeleteLine("line2"); |
ok($editor->LineCount(), $linecount-1); |
ok($editor->LineCount(), $linecount-1); |
|
|
my $hashref = $editor->{KeyToLines}; |
$hashref = $editor->{KeyToLines}; |
ok($hashref->{"line1"}, 0); |
ok($hashref->{"line1"}, 0); |
|
|
ok($hashref->{"last"}, $editor->LineCount()-1); |
ok($hashref->{"last"}, $initiallast-1); |
|
|
|
my $deleted = $editor->Find("line2"); |
|
if(!defined($deleted)) { |
|
ok(1); |
|
} else { |
|
ok(0); |
|
} |
|
|
} |
} |
|
|
# |
# |
Line 87 sub TestDeleteEnd {
|
Line 98 sub TestDeleteEnd {
|
ok($hashref->{"line1"}, $line1idx); |
ok($hashref->{"line1"}, $line1idx); |
ok($hashref->{"line2"}, $line2idx); |
ok($hashref->{"line2"}, $line2idx); |
|
|
|
my $deleted = $editor->Find("last"); |
|
if(!defined($deleted)) { |
|
ok(1); |
|
} else { |
|
ok(0); |
|
} |
|
|
} |
} |
|
|
TestDeleteMiddle; |
TestDeleteMiddle; |