diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2019-01-28 17:16:50 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2019-01-28 17:16:50 +0300 |
commit | 7dddfe2143e28dcde147d8420f0bd129babaec3a (patch) | |
tree | 5aa0463318a82e026cb01f57b1169a02ff04f433 /test/perl/body_io_fake/IOFake.pm | |
parent | eced6bc97284478d67bfec04e204e4cd212167d9 (diff) | |
download | unit-7dddfe2143e28dcde147d8420f0bd129babaec3a.tar.gz unit-7dddfe2143e28dcde147d8420f0bd129babaec3a.tar.bz2 |
Tests: added test for reading body from IO::Handle-like object.
Diffstat (limited to '')
-rw-r--r-- | test/perl/body_io_fake/IOFake.pm | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/perl/body_io_fake/IOFake.pm b/test/perl/body_io_fake/IOFake.pm new file mode 100644 index 00000000..d2542aa5 --- /dev/null +++ b/test/perl/body_io_fake/IOFake.pm @@ -0,0 +1,33 @@ +package IOFake; + +sub new { + my $class = shift; + my $errors = shift; + my $self = {}; + + $self->{_count} = 2; + $self->{_errors} = $errors; + + bless $self, $class; + return $self; +} + +sub getline() { + my $self = shift; + + if ($self->{_count} > 0) { + return $self->{_count}--; + } + + $self->{_errors}->print('IOFake getline() $/ is ' . ${ $/ }); + + return; +} + +sub close() { + my $self = shift; + + $self->{_errors}->print('IOFake close() called'); +}; + +1; |