about summary refs log tree commit homepage
path: root/t/mwrap.t
diff options
context:
space:
mode:
Diffstat (limited to 't/mwrap.t')
-rw-r--r--t/mwrap.t21
1 files changed, 20 insertions, 1 deletions
diff --git a/t/mwrap.t b/t/mwrap.t
index 6f99715..ccd739b 100644
--- a/t/mwrap.t
+++ b/t/mwrap.t
@@ -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"