File: handle.t

package info (click to toggle)
libapache-admin-config-perl 0.94-1.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, lenny, squeeze, stretch, wheezy
  • size: 184 kB
  • ctags: 69
  • sloc: perl: 858; makefile: 3
file content (53 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use strict;
use Test;
plan test => 14;

use Apache::Admin::Config;
ok(1);

open(HTTPD_CONF, 't/httpd.conf-dist');
ok(fileno HTTPD_CONF);

my $apache = new Apache::Admin::Config (\*HTTPD_CONF);
ok(defined $apache);

my @dirlist = $apache->directive;
ok(@dirlist, 88);

my @dirvals = $apache->directive('browsermatch');
ok(@dirvals, 5);

my $obj = $dirvals[0];
ok(defined $obj);

open(HTTPD_TMP, "+>/tmp/httpd.conf-$$-aac");
ok(fileno HTTPD_TMP);

ok($apache->save(\*HTTPD_TMP));

close(HTTPD_TMP);
open(HTTPD_TMP, "+</tmp/httpd.conf-$$-aac");

$apache = new Apache::Admin::Config \*HTTPD_TMP;
ok(defined $apache);
seek(HTTPD_TMP, 0, 0);

@dirlist = $apache->directive;
ok(@dirlist, 88);

my $rv = $apache->add_directive(test=>'bla');
ok($rv->value, 'bla');
ok($apache->save());

close(HTTPD_TMP);
open(HTTPD_TMP, "+</tmp/httpd.conf-$$-aac");

$apache = new Apache::Admin::Config \*HTTPD_TMP;
ok(defined $apache);

@dirlist = $apache->directive;
ok(@dirlist, 89);

unlink("/tmp/httpd.conf-$$-aac");
close(HTTPD_TMP);
close(HTTPD_CONF);