Commit 0d1c9014 authored by Geoff Simmons's avatar Geoff Simmons

add tests for compile option newline

parent bf433abf
......@@ -686,3 +686,54 @@ client c1 {
expect resp.http.r6-4 == "false"
expect resp.http.r6-5 == "false"
} -run
# newline
varnish v1 -vcl {
import pcre2 from "${vmod_topbuild}/src/.libs/libvmod_pcre2.so";
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new r1 = pcre2.regex("^abc", newline=LF, multiline=true);
new r2 = pcre2.regex("^abc", newline=CRLF, multiline=true);
new r3 = pcre2.regex("^abc", newline=CR, multiline=true);
new r4 = pcre2.regex("^a.b", newline=LF);
new r5 = pcre2.regex("^a.b", newline=CR);
new r6 = pcre2.regex("^a.b", newline=ANYCRLF);
new r7 = pcre2.regex("^a.b", newline=ANY);
}
sub vcl_recv {
return(synth(200));
}
# As above
include "${vmod_topbuild}/src/tests/newline_synth.vcl";
}
client c1 {
txreq
rxresp
expect resp.status == "200"
expect resp.http.r1-1 == "true"
expect resp.http.r1-2 == "true"
expect resp.http.r1-3 == "false"
expect resp.http.r1-4 == "false"
expect resp.http.r1-5 == "false"
expect resp.http.r1-6 == "false"
expect resp.http.r1-7 == "false"
expect resp.http.r2-1 == "true"
expect resp.http.r2-2 == "false"
expect resp.http.r2-3 == "false"
expect resp.http.r3-1 == "true"
expect resp.http.r3-2 == "false"
expect resp.http.r3-3 == "false"
expect resp.http.r4-1 == "true"
expect resp.http.r4-2 == "false"
expect resp.http.r5-1 == "true"
expect resp.http.r5-2 == "false"
expect resp.http.r6-1 == "true"
expect resp.http.r6-2 == "false"
expect resp.http.r7-1 == "false"
expect resp.http.r7-2 == "false"
expect resp.http.r7-3 == "false"
} -run
# -*-mode: vcl; coding: raw-text -*-
# For the newline test in compile_opts.vtc. Loaded via include, since
# vcl.inline, which is used by vtc, apparently changes \r characters
# to \n.
sub vcl_synth {
set resp.http.r1-1 = r1.match({"xyz
abc"});
set resp.http.r1-2 = r1.match({"xyz
abc"});
set resp.http.r1-3 = r1.match({"xyz abc"});
set resp.http.r1-4 = r1.match({"xyzabc "});
set resp.http.r1-5 = r1.match({"xyzabc pqr"});
set resp.http.r1-6 = r1.match({"xyzabc
"});
set resp.http.r1-7 = r1.match({"xyzabc
pqr"});
set resp.http.r2-1 = r2.match({"xyz
abclf>"});
set resp.http.r2-2 = r2.match({"xyz
abclf"});
set resp.http.r2-3 = r2.match({"xyz abclf"});
set resp.http.r3-1 = r3.match({"xyz abc"});
set resp.http.r3-2 = r3.match({"xyz
abc"});
set resp.http.r3-3 = r3.match({"xyz
abc"});
set resp.http.r4-1 = r4.match({"a b"});
set resp.http.r4-2 = r4.match({"a
b"});
set resp.http.r5-1 = r5.match({"a
b"});
set resp.http.r5-2 = r5.match({"a b"});
set resp.http.r6-1 = r6.match({"ab"});
set resp.http.r6-2 = r6.match({"a b"});
set resp.http.r7-1 = r7.match({"a
b"});
set resp.http.r7-2 = r7.match({"a b"});
set resp.http.r7-3 = r7.match({"ab"});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment