--- loncom/cfgedittests/delete.t 2003/11/25 12:15:35 1.2 +++ loncom/cfgedittests/delete.t 2003/12/02 12:12:16 1.3 @@ -1,5 +1,5 @@ # -# $Id: delete.t,v 1.2 2003/11/25 12:15:35 foxr Exp $ +# $Id: delete.t,v 1.3 2003/12/02 12:12:16 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,7 +43,7 @@ use ConfigFileEdit; # from the middle. # -BEGIN {plan tests => 6} +BEGIN {plan tests => 8} # # Test deletion of middle element. @@ -57,13 +57,24 @@ sub TestDeleteMiddle { my $editor = ConfigFileEdit->new("test2config.cfg", 0); my $linecount = $editor->LineCount(); + my $hashref = $editor->{KeyToLines}; + my $initiallast = $hashref->{"last"}; + $editor->DeleteLine("line2"); ok($editor->LineCount(), $linecount-1); - my $hashref = $editor->{KeyToLines}; + $hashref = $editor->{KeyToLines}; 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); + } + } # @@ -87,6 +98,13 @@ sub TestDeleteEnd { ok($hashref->{"line1"}, $line1idx); ok($hashref->{"line2"}, $line2idx); + my $deleted = $editor->Find("last"); + if(!defined($deleted)) { + ok(1); + } else { + ok(0); + } + } TestDeleteMiddle;