diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-03-31 14:13:46 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-03-31 14:13:46 +0000 |
commit | 492dd716bdbd866fc28eacfe5082910dfa9e7590 (patch) | |
tree | 15bad6962ad73c62835002aadf44dd2163c69282 /perl_checker.src/test/read_t.pm | |
parent | 5a13ba64777f14718ae20e4bca2a80f39304c367 (diff) | |
download | perl_checker-492dd716bdbd866fc28eacfe5082910dfa9e7590.tar perl_checker-492dd716bdbd866fc28eacfe5082910dfa9e7590.tar.gz perl_checker-492dd716bdbd866fc28eacfe5082910dfa9e7590.tar.bz2 perl_checker-492dd716bdbd866fc28eacfe5082910dfa9e7590.tar.xz perl_checker-492dd716bdbd866fc28eacfe5082910dfa9e7590.zip |
add tests for perl_checker
Diffstat (limited to 'perl_checker.src/test/read_t.pm')
-rw-r--r-- | perl_checker.src/test/read_t.pm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/perl_checker.src/test/read_t.pm b/perl_checker.src/test/read_t.pm new file mode 100644 index 0000000..d7d9b9c --- /dev/null +++ b/perl_checker.src/test/read_t.pm @@ -0,0 +1,27 @@ +package read_t; + +use lib '../..'; +use MDK::Common; + +sub read_t { + my ($file) = @_; + + my @tests; + my ($column_width, $line_number, @lines, @logs); + foreach (cat_($file), "\n") { + if (/^$/) { + push @tests, { line_number => $line_number, lines => [ @lines ], logs => [ @logs ] } if @lines; + @lines = @logs = (); + } else { + $column_width ||= length(first(/(.{20}\s+)/)); + my ($line, $log) = $column_width > 25 && /(.{$column_width})(.*)/ ? (chomp_($1) . "\n", $2) : ($_, ''); + push @lines, $line; + push @logs, $log; + } + $line_number++; + } + @tests; +} + +1; + |