From c9cf025fadfe043f0f2f679e10d1207d8a158bb6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 17:01:31 +0200 Subject: Adding debian version 2.4.57-2. Signed-off-by: Daniel Baumann --- debian/perl-framework/Apache-Test/t/log_watch.t | 76 +++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 debian/perl-framework/Apache-Test/t/log_watch.t (limited to 'debian/perl-framework/Apache-Test/t/log_watch.t') diff --git a/debian/perl-framework/Apache-Test/t/log_watch.t b/debian/perl-framework/Apache-Test/t/log_watch.t new file mode 100644 index 0000000..7a69f3f --- /dev/null +++ b/debian/perl-framework/Apache-Test/t/log_watch.t @@ -0,0 +1,76 @@ +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; +use Apache::TestUtil qw/t_start_file_watch + t_read_file_watch + t_finish_file_watch + t_write_file + t_append_file + t_catfile + t_cmp/; + +plan tests => 11; + +my $fn=t_catfile(Apache::Test::vars->{t_logs}, 'watch'); +unlink $fn; + +t_start_file_watch 'watch'; + +t_write_file $fn, "1\n2\n"; + +ok t_cmp [t_read_file_watch 'watch'], ["1\n", "2\n"], + "t_read_file_watch on previously non-existing file"; + +t_append_file $fn, "3\n4\n"; + +ok t_cmp [t_read_file_watch 'watch'], ["3\n", "4\n"], + "subsequent t_read_file_watch"; + +t_append_file $fn, "5\n6\n"; + +ok t_cmp [t_finish_file_watch 'watch'], ["5\n", "6\n"], + "subsequent t_finish_file_watch"; + +ok t_cmp [t_finish_file_watch 'watch'], ["1\n","2\n","3\n","4\n","5\n","6\n"], + "t_finish_file_watch w/o start"; + +ok t_cmp [t_read_file_watch 'watch'], ["1\n","2\n","3\n","4\n","5\n","6\n"], + "t_read_file_watch w/o start"; + +ok t_cmp [t_read_file_watch 'watch'], [], + "subsequent t_read_file_watch"; + +t_append_file $fn, "7\n8\n"; +unlink $fn; + +ok t_cmp [t_read_file_watch 'watch'], ["7\n","8\n"], + "subsequent t_read_file_watch file unlinked"; + +t_write_file $fn, "1\n2\n3\n4\n5\n6\n7\n8\n"; + +ok t_cmp [t_finish_file_watch 'watch'], [], + "subsequent t_finish_file_watch - new file exists but fh is cached"; + +t_start_file_watch 'watch'; + +ok t_cmp [t_read_file_watch 'watch'], [], + "t_read_file_watch at EOF"; + +# Make sure the file is closed before deleting it on Windows. +t_finish_file_watch 'watch' if $^O eq 'MSWin32'; + +unlink $fn; +t_start_file_watch 'watch'; + +t_write_file $fn, "1\n2\n3\n4\n5\n6\n7\n8\n"; + +{ + local $/=\4; + + ok t_cmp [scalar t_read_file_watch 'watch'], ["1\n2\n"], + "t_read_file_watch fixed record length / scalar context"; + + ok t_cmp [t_finish_file_watch 'watch'], ["3\n4\n","5\n6\n","7\n8\n"], + "t_finish_file_watch fixed record length"; +} -- cgit v1.2.3