comparison random_index.t @ 148:b714d6df958c

Tests: rename some tests for better sorting. Use underscore instead of dash. Addtionally, rename some tests to better match "module" + "details" scheme used: use "http_" prefix for http core module tests, use "mail_" prefix for mail module tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 04 Mar 2011 16:07:15 +0300
parents random-index.t@8ac1faaddd2c
children c0ae29632905
comparison
equal deleted inserted replaced
147:fd865ada95c8 148:b714d6df958c
1 #!/usr/bin/perl
2
3 # (C) Maxim Dounin
4
5 # Tests for random index module.
6
7 ###############################################################################
8
9 use warnings;
10 use strict;
11
12 use Test::More;
13
14 BEGIN { use FindBin; chdir($FindBin::Bin); }
15
16 use lib 'lib';
17 use Test::Nginx;
18
19 ###############################################################################
20
21 select STDERR; $| = 1;
22 select STDOUT; $| = 1;
23
24 my $t = Test::Nginx->new()->has(qw/http random_index/)->plan(1)
25 ->write_file_expand('nginx.conf', <<'EOF');
26
27 %%TEST_GLOBALS%%
28
29 master_process off;
30 daemon off;
31
32 events {
33 }
34
35 http {
36 %%TEST_GLOBALS_HTTP%%
37
38 server {
39 listen 127.0.0.1:8080;
40 server_name localhost;
41
42 location / {
43 random_index on;
44 }
45 }
46 }
47
48 EOF
49
50 my $d = $t->testdir();
51
52 mkdir("$d/x");
53 mkdir("$d/x/test-dir");
54 symlink("$d/x/test-dir", "$d/x/test-dir-link");
55
56 $t->write_file('test-file', 'RIGHT');
57 symlink("$d/test-file", "$d/x/test-file-link");
58
59 $t->run();
60
61 ###############################################################################
62
63 like(http_get('/x/'), qr/RIGHT/s, 'file');
64
65 ###############################################################################