aboutsummaryrefslogtreecommitdiff
path: root/tests/getpart.pm
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2012-06-05 20:01:23 +0200
committerYang Tse <yangsita@gmail.com>2012-06-05 20:20:39 +0200
commit62f374b19e2c6cfd417df4a6781a8b8e0a338df4 (patch)
tree065c0d03c7a63eab1646feff76cb03d6f36b31cc /tests/getpart.pm
parent89b5680d8189fa7c58f20b273a982733b93d49ac (diff)
tests: adjust file part behavior in test verify section.
When a <file> part is now specified with no contents at all, this will actually verify that the specified file has no contents at all. Previously file contents would be ignored.
Diffstat (limited to 'tests/getpart.pm')
-rw-r--r--tests/getpart.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/getpart.pm b/tests/getpart.pm
index 1aeedd6dd..d9510dd20 100644
--- a/tests/getpart.pm
+++ b/tests/getpart.pm
@@ -124,6 +124,25 @@ sub getpart {
return @this; #empty!
}
+sub partexists {
+ my ($section, $part)=@_;
+
+ my $inside = 0;
+
+ for(@xml) {
+ if(!$inside && ($_ =~ /^ *\<$section/)) {
+ $inside++;
+ }
+ elsif((1 == $inside) && ($_ =~ /^ *\<$part[ \>]/)) {
+ return 1; # exists
+ }
+ elsif((1 == $inside) && ($_ =~ /^ *\<\/$section/)) {
+ return 0; # does not exist
+ }
+ }
+ return 0; # does not exist
+}
+
# Return entire document as list of lines
sub getall {
return @xml;