--- /dev/null
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More tests => 2 * 4 * 5;
+
+use B::RecDeparse;
+
+my $brd = B::RecDeparse->new(level => -1);
+
+sub foo { 123 }
+my $pkg;
+
+my @tests = (
+ [ e1 => 'foo()', '123' ],
+ [ e2 => 'foo(1)', '123' ],
+ [ e3 => 'foo(@_)', '123' ],
+ [ e4 => 'foo(shift)', '123' ],
+
+ [ x1 => 'bar()', 'bar' ],
+ [ x2 => 'bar(1)', 'bar' ],
+ [ x3 => 'bar(@_)', 'bar' ],
+ [ x4 => 'bar(shift)', 'bar' ],
+
+ [ m1 => '"pkg"->qux()', 'qux' ],
+ [ m2 => '"pkg"->qux(1)', 'qux' ],
+ [ m3 => '"pkg"->qux(@_)', 'qux' ],
+ [ m4 => '"pkg"->qux(shift)', 'qux' ],
+ [ m5 => '$pkg->qux()', 'qux' ],
+ [ m6 => '$pkg->qux(1)', 'qux' ],
+ [ m7 => '$pkg->qux(@_)', 'qux' ],
+ [ m8 => '$pkg->qux(shift)', 'qux' ],
+ [ m9 => 'shift->qux()', 'qux' ],
+ [ m10 => 'shift->qux(1)', 'qux' ],
+ [ m11 => 'shift->qux(@_)', 'qux' ],
+ [ m12 => 'shift->qux(shift)', 'qux' ],
+);
+
+for my $test (@tests) {
+ my ($name, $source, $match) = @$test;
+
+ my $code = do {
+ local $@;
+ eval "sub { $source }";
+ };
+
+ my $res = eval { $brd->coderef2text($code) };
+ is $@, '', "deparsing sub $name doesn't croak";
+ $res = '' unless defined $res;
+ like $res, qr/\Q$match\E/, "deparsing sub $name works as expected";
+}