mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-30 18:37:12 +00:00
Allow BEGINDATA and ENDDATA to wrap data inside the test file.
This commit is contained in:
parent
87bcd73eb9
commit
b33e639f8c
@ -16,9 +16,21 @@ my $is_head_request = 0;
|
||||
my @auth = ( "--user", "user1:user1" );
|
||||
|
||||
my $datafile = "tests/$suite/$test.data";
|
||||
my $in_data = 0;
|
||||
my $data_binary;
|
||||
|
||||
open( TEST, '<', "tests/$suite/$test.test" ) or die "Can't open 'tests/$suite/$test.test'";
|
||||
while( <TEST> ) {
|
||||
if ( $in_data ) {
|
||||
if ( /^ENDDATA$/ ) {
|
||||
$in_data = 0;
|
||||
}
|
||||
else {
|
||||
$data_binary .= $_;
|
||||
}
|
||||
next;
|
||||
}
|
||||
|
||||
/^\s*(#|$)/ && next;
|
||||
|
||||
/^\s*HEAD\s*(#|$|=)/ && do {
|
||||
@ -37,6 +49,11 @@ while( <TEST> ) {
|
||||
$datafile="tests/$suite/$1.data";
|
||||
};
|
||||
|
||||
/^BEGINDATA$/ && do {
|
||||
$data_binary = "";
|
||||
$in_data = 1;
|
||||
};
|
||||
|
||||
/^\s*VERBOSE\s*(#|$|=)/ && do {
|
||||
push @arguments, "--verbose";
|
||||
};
|
||||
@ -76,7 +93,9 @@ push @arguments, @auth;
|
||||
|
||||
if ( -f $datafile ) {
|
||||
push @arguments, "--data-binary", "\@$datafile";
|
||||
# print "Using datafile: ", $datafile,"\n";
|
||||
}
|
||||
elsif ( defined($data_binary) ) {
|
||||
push @arguments, "--data-binary", $data_binary;
|
||||
}
|
||||
else {
|
||||
undef($datafile);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user