summaryrefslogtreecommitdiff
path: root/tests/core-condition.t
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2022-04-05 18:09:11 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2022-04-08 06:33:02 -0400
commit7258624e51b4bdb1b79f19f6c31ca7814cabcee1 (patch)
tree19052efb2817dc39961552ee13e0ca7bc254d81c /tests/core-condition.t
parentdcb5f2318b163028f4bb7a18b2211facbd997713 (diff)
downloadlighttpd-git-7258624e51b4bdb1b79f19f6c31ca7814cabcee1.tar.gz
[tests] able to run tests when built w/o pcre
perl test framework now runs most tests even when lighttpd has been built without pcre support, though some tests which rely on regex are skipped (tests/core-condition.t)
Diffstat (limited to 'tests/core-condition.t')
-rwxr-xr-xtests/core-condition.t17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/core-condition.t b/tests/core-condition.t
index 2ba70aa9..652135c3 100755
--- a/tests/core-condition.t
+++ b/tests/core-condition.t
@@ -8,10 +8,12 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 25;
+use Test::More tests => 26;
use LightyTest;
my $tf = LightyTest->new();
+my $has_pcre = $tf->has_feature("PCRE support");
+$ENV{condition_include_file} = $has_pcre ? "var-include-sub.conf" : "nonexistent-glob*";
my $t;
$ENV{"env_test"} = "good_env";
@@ -19,6 +21,9 @@ $ENV{"env_test"} = "good_env";
$tf->{CONFIGFILE} = 'condition.conf';
ok($tf->start_proc == 0, "Starting lighttpd") or die();
+SKIP: {
+ skip "skipping tests requiring PCRE", 24 unless $has_pcre;
+
$t->{REQUEST} = ( <<EOF
GET /index.html HTTP/1.0
Host: www.example.org
@@ -88,6 +93,14 @@ $t->{REQUEST} = ( "GET /index.html HTTP/1.0\r\nHost: www.example.org\r\n" );
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_1" } ];
ok($tf->handle_http($t) == 0, 'basic test');
+$t->{REQUEST} = ( <<EOF
+GET /rewrite/all/some+test%3axxx%20with%20space HTTP/1.0
+Host: test.example.org
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => '/some+test%3Axxx%20with%20space' } ];
+ok($tf->handle_http($t) == 0, 'rewritten urls work with encoded path');
+
my $myvar = "good";
my $server_name = "test.example.org";
my $mystr = "string";
@@ -122,4 +135,6 @@ EOF
ok($tf->handle_http($t) == 0, $test);
}
+}
+
ok($tf->stop_proc == 0, "Stopping lighttpd");