Mercurial > hg > nginx-tests
diff lib/Test/Nginx.pm @ 467:43e05ac6c23c
Tests: the read_file function added in Test::Nginx.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 22 Sep 2014 13:30:04 +0400 |
parents | 0342957cca37 |
children | 084f8c8cb648 |
line wrap: on
line diff
--- a/lib/Test/Nginx.pm Mon Sep 22 13:29:20 2014 +0400 +++ b/lib/Test/Nginx.pm Mon Sep 22 13:30:04 2014 +0400 @@ -313,6 +313,18 @@ return $self; } +sub read_file($) { + my ($self, $name) = @_; + local $/; + + open F, '<', $self->{_testdir} . '/' . $name + or die "Can't open $name: $!"; + my $content = <F>; + close F; + + return $content; +} + sub write_file($$) { my ($self, $name, $content) = @_;