Skip to content

Commit

Permalink
Add Data::Dumper::qquote() Fast Exit Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DabeDotCom committed Jun 19, 2024
1 parent ef8a989 commit c9ba999
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -3564,6 +3564,7 @@ dist/Data-Dumper/t/overload.t See if Data::Dumper works for overloaded data
dist/Data-Dumper/t/pair.t See if Data::Dumper pair separator works
dist/Data-Dumper/t/perl-74170.t Regression test for stack reallocation
dist/Data-Dumper/t/purity_deepcopy_maxdepth.t See if three Data::Dumper functions work
dist/Data-Dumper/t/qquote.t See if Data::Dumper::qquote() works
dist/Data-Dumper/t/qr.t See if Data::Dumper works with qr|/|
dist/Data-Dumper/t/quotekeys.t See if Data::Dumper::Quotekeys works
dist/Data-Dumper/t/recurse.t See if Data::Dumper::Maxrecurse works
Expand Down
82 changes: 82 additions & 0 deletions dist/Data-Dumper/t/qquote.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!./perl -w
# t/seen.t - Test Seen()

use strict;
use warnings;

#use lib qw( . );
#use Dumper;
use Test::More tests => 16;
#use lib qw( ./t/lib );

{
my $warning = '';
local $SIG{__WARN__} = sub { $warning = $_[0] };

my $str = Data::Dumper::qquote("");
is($str, q{""}, q{qquote("") returned ""});
is($warning, "", q{qquote("") did not warn});
}

{
my $warning = '';
local $SIG{__WARN__} = sub { $warning = $_[0] };

my $str = Data::Dumper::qquote();
is($str, q{""}, q{qquote() returned ""});
is($warning, "", q{qquote() did not warn});
}

{
my $warning = '';
local $SIG{__WARN__} = sub { $warning = $_[0] };

my $str = Data::Dumper::qquote(undef);
is($str, q{""}, q{qquote(undef) returned ""});
is($warning, "", q{qquote(undef) did not warn});
}

{
my $warning = '';
local $SIG{__WARN__} = sub { $warning = $_[0] };

my $str = Data::Dumper::qquote("simple");
is($str, q{"simple"}, q{qquote("simple") returned "simple"});
is($warning, "", q{qquote("simple") did not warn});
}

{
my $warning = '';
local $SIG{__WARN__} = sub { $warning = $_[0] };

my $str = Data::Dumper::qquote(q{check 'single' quote});
is($str, q{"check 'single' quote"}, q{qquote('single') returned correctly});
is($warning, "", q{qquote('single') did not warn});
}

{
my $warning = '';
local $SIG{__WARN__} = sub { $warning = $_[0] };

my $str = Data::Dumper::qquote(q{check "double" quote});
is($str, q{"check \"double\" quote"}, q{qquote("double") returned correctly});
is($warning, "", 'qquote(undef) did not warn');
}

{
my $warning = '';
local $SIG{__WARN__} = sub { $warning = $_[0] };

my $str = Data::Dumper::qquote(qq{check \a quote});
is($str, q{"check \a quote"}, q{qquote("\a") returned correctly});
is($warning, "", 'qquote(undef) did not warn');
}

{
my $warning = '';
local $SIG{__WARN__} = sub { $warning = $_[0] };

my $str = Data::Dumper::qquote(qq{check \cg quote});
is($str, q{"check \a quote"}, q{qquote("\cg") returned correctly});
is($warning, "", 'qquote(undef) did not warn');
}

0 comments on commit c9ba999

Please sign in to comment.