Tests: access_log escape tests merged.
diff --git a/access_log.t b/access_log.t
index a3d1a0d..4401f51 100644
--- a/access_log.t
+++ b/access_log.t
@@ -1,5 +1,6 @@
#!/usr/bin/perl
+# (C) Sergey Kandaurov
# (C) Nginx, Inc.
# Tests for access_log.
@@ -21,7 +22,7 @@
select STDERR; $| = 1;
select STDOUT; $| = 1;
-my $t = Test::Nginx->new()->has(qw/http rewrite gzip/)->plan(15)
+my $t = Test::Nginx->new()->has(qw/http rewrite gzip/)->plan(18)
->write_file_expand('nginx.conf', <<'EOF');
%%TEST_GLOBALS%%
@@ -38,6 +39,10 @@
log_format long "long line $uri:$status";
log_format binary $binary_remote_addr;
+ log_format default escape=default $arg_a$arg_b$arg_c;
+ log_format none escape=none $arg_a$arg_b$arg_c;
+ log_format json escape=json $arg_a$arg_b$arg_c;
+
server {
listen 127.0.0.1:8080;
server_name localhost;
@@ -99,6 +104,12 @@
location /binary {
access_log %%TESTDIR%%/binary.log binary;
}
+
+ location /escape {
+ access_log %%TESTDIR%%/test.log default;
+ access_log %%TESTDIR%%/none.log none;
+ access_log %%TESTDIR%%/json.log json;
+ }
}
}
@@ -146,6 +157,8 @@
http_get('/binary');
+http_get('/escape?a="1 \\ ' . pack("n", 0x1b1c) . ' "&c=2');
+
http_get('/cache?logname=lru');
http_get('/cache?logname=lru');
http_get('/cache?logname=once');
@@ -243,6 +256,15 @@
is($t->read_file('binary.log'), "$expected\n", 'binary');
+# characters escaping
+
+is($t->read_file('test.log'),
+ '\x221 \x5C \x1B\x1C \x22-2' . "\n", 'escape - default');
+is($t->read_file('none.log'),
+ '"1 \\ ' . pack("n", 0x1b1c) . " \"2\n", 'escape - none');
+is($t->read_file('json.log'),
+ '\"1 \\\\ \u001B\u001C \"2' . "\n", 'escape - json');
+
SKIP: {
skip 'win32', 4 if $^O eq 'MSWin32';
diff --git a/access_log_escape.t b/access_log_escape.t
deleted file mode 100644
index 7e95816..0000000
--- a/access_log_escape.t
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/perl
-
-# (C) Sergey Kandaurov
-# (C) Nginx, Inc.
-
-# Tests for access_log with escape parameter.
-
-###############################################################################
-
-use warnings;
-use strict;
-
-use Test::More;
-
-BEGIN { use FindBin; chdir($FindBin::Bin); }
-
-use lib 'lib';
-use Test::Nginx;
-
-###############################################################################
-
-select STDERR; $| = 1;
-select STDOUT; $| = 1;
-
-my $t = Test::Nginx->new()->has(qw/http/)->plan(2)
- ->write_file_expand('nginx.conf', <<'EOF');
-
-%%TEST_GLOBALS%%
-
-daemon off;
-
-events {
-}
-
-http {
- %%TEST_GLOBALS_HTTP%%
-
- log_format json escape=json $arg_a$arg_b$arg_c;
- log_format default escape=default $arg_a$arg_b$arg_c;
-
- server {
- listen 127.0.0.1:8080;
- server_name localhost;
-
- access_log %%TESTDIR%%/json.log json;
- access_log %%TESTDIR%%/test.log default;
- }
-}
-
-EOF
-
-$t->run();
-
-###############################################################################
-
-http_get('/?a="1 \\ ' . pack("n", 0x1b1c) . ' "&c=2');
-
-$t->stop();
-
-is($t->read_file('json.log'), '\"1 \\\\ \u001B\u001C \"2' . "\n", 'json');
-is($t->read_file('test.log'), '\x221 \x5C \x1B\x1C \x22-2' . "\n", 'default');
-
-###############################################################################
diff --git a/access_log_none.t b/access_log_none.t
deleted file mode 100644
index 8fca628..0000000
--- a/access_log_none.t
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/perl
-
-# (C) Sergey Kandaurov
-# (C) Nginx, Inc.
-
-# Tests for access_log with escape parameter.
-
-###############################################################################
-
-use warnings;
-use strict;
-
-use Test::More;
-
-BEGIN { use FindBin; chdir($FindBin::Bin); }
-
-use lib 'lib';
-use Test::Nginx;
-
-###############################################################################
-
-select STDERR; $| = 1;
-select STDOUT; $| = 1;
-
-my $t = Test::Nginx->new()->has(qw/http/)->plan(1)
- ->write_file_expand('nginx.conf', <<'EOF');
-
-%%TEST_GLOBALS%%
-
-daemon off;
-
-events {
-}
-
-http {
- %%TEST_GLOBALS_HTTP%%
-
- log_format none escape=none $arg_a$arg_b$arg_c;
-
- server {
- listen 127.0.0.1:8080;
- server_name localhost;
-
- access_log %%TESTDIR%%/none.log none;
- }
-}
-
-EOF
-
-$t->run();
-
-###############################################################################
-
-http_get('/?a="1 \\ ' . pack("n", 0x1b1c) . ' "&c=2');
-
-$t->stop();
-
-is($t->read_file('none.log'), '"1 \\ ' . pack("n", 0x1b1c) . " \"2\n", 'none');
-
-###############################################################################