summaryrefslogtreecommitdiff
path: root/t/format.t
diff options
context:
space:
mode:
Diffstat (limited to 't/format.t')
-rw-r--r--t/format.t17
1 files changed, 4 insertions, 13 deletions
diff --git a/t/format.t b/t/format.t
index 06b9884..2d124fc 100644
--- a/t/format.t
+++ b/t/format.t
@@ -1,25 +1,22 @@
# -*- perl -*-
use lib qw(t lib);
use strict;
use warnings;
use Test::More;
-use autodie;
BEGIN {
plan tests => 6;
use_ok('Test::HAProxy');
}
my $hp = new Test::HAProxy;
isa_ok($hp,'Test::HAProxy');
my $s;
-open(my $fh, '>', \$s);
-$hp->write($fh);
-close $fh;
+$hp->write(\$s);
is($s, q{global
# comment
log /dev/log daemon
user haproxy
group haproxy
@@ -30,15 +27,13 @@ frontend in
mode http
bind :::80 v4v6
backend out
server localhost http://127.0.0.1
}, 'default write');
-open($fh, '>', \$s);
-$hp->write($fh, indent => 2);
-close $fh;
+$hp->write(\$s, indent => 2);
is($s, q{global
# comment
log /dev/log daemon
user haproxy
group haproxy
@@ -49,15 +44,13 @@ frontend in
mode http
bind :::80 v4v6
backend out
server localhost http://127.0.0.1
}, 'reindent');
-open($fh, '>', \$s);
-$hp->write($fh, indent => 2, reindent_comments => 1);
-close $fh;
+$hp->write(\$s, indent => 2, reindent_comments => 1);
is($s, q{global
# comment
log /dev/log daemon
user haproxy
group haproxy
@@ -68,15 +61,13 @@ frontend in
mode http
bind :::80 v4v6
backend out
server localhost http://127.0.0.1
}, 'reindent comments');
-open($fh, '>', \$s);
-$hp->write($fh, indent => 4, tabstop => [ 10, 24 ]);
-close $fh;
+$hp->write(\$s, indent => 4, tabstop => [ 10, 24 ]);
is($s, q{global
# comment
log /dev/log daemon
user haproxy
group haproxy

Return to:

Send suggestions and report system problems to the System administrator.