diff options
Diffstat (limited to 't/mwrap.t')
-rw-r--r-- | t/mwrap.t | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -9,7 +9,8 @@ my $dump = "$mwrap_tmp/dump"; { my $env = { MWRAP => "dump_path:$dump,dump_min:10000" }; my $nr = 1000; - mwrap_run('dump test', $env, '-e', '$x = "hello world" x '.$nr); + my $script = '$x = "hello world" x '.$nr; + mwrap_run('dump test', $env, '-e', $script); ok(-s $dump, "dump file written to"); my $s = slurp($dump); truncate($dump, 0); @@ -23,6 +24,24 @@ my $dump = "$mwrap_tmp/dump"; } else { fail("$s failed to match $re"); } + + $env->{MWRAP} = "dump_csv:$dump"; + mwrap_run('dump_csv test', $env, '-e', $script); + ok(-s $dump, "CSV written to path"); + $s = slurp($dump); + truncate($dump, 0); + my $nr_comma = ($s =~ tr/,/,/); + my $nr_cr = ($s =~ tr/\n/\n/); + ok($nr_comma > ($nr_cr * 4), 'CSV has more commas than CR'); + + $env->{MWRAP} = 'dump_csv,dump_fd:2'; + mwrap_run('dump_csv,dump_fd test', $env, '-e', $script); + ok(-s $mwrap_err, "CSV written to stderr"); + $s = slurp($mwrap_err); + truncate($mwrap_err, 0); + $nr_comma = ($s =~ tr/,/,/); + $nr_cr = ($s =~ tr/\n/\n/); + ok($nr_comma > ($nr_cr * 4), 'CSV has more commas than CR'); } SKIP: { # C++ program which uses malloc via "new" |