Carp-Parse-Redact

 view release on metacpan or  search on metacpan

t/10-parse_stack_trace.t  view on Meta::CPAN

		"password",
		"[redacted]",
		"planet",
		"degobah",
		"ship_zip",
		"[redacted]",
		"username",
		"[redacted]",
	],
	[],
	[ "CODE(0xb3d4f48)", "Try::Tiny::Finally=REF(0xaf503f0)" ],
];

subtest(
	'Sensitive information is redacted out.',
	sub
	{
		plan( tests => scalar( @$expected_redacted_caller_information ) );
		
		for ( my $i = 0; $i < scalar( @$expected_redacted_caller_information ); $i++ )
		{

t/10-parse_stack_trace.t  view on Meta::CPAN

	},
);


__DATA__
Test.
at test/lib/Spock/test.t line 116
main::test_trace('gift_message', 'Happy\x{a}Birthday\x{a}\x{9}Love,\x{a}\x{9}Timmy', 'password', 'thereisnotry', 'planet', 'degobah', 'ship_zip', 01138, 'username', 'yoda') called at test/lib/Spock/test.t line 61
main::__ANON__() called at /home/spock/site_perl/5.14.2/Try/Tiny.pm line 76
eval {...} called at /home/spock/site_perl/5.14.2/Try/Tiny.pm line 67
Try::Tiny::try('CODE(0xb3d4f48)', 'Try::Tiny::Finally=REF(0xaf503f0)') called at test/lib/Spock/test.t line 69

t/11-parse_stack_trace-regexp.t  view on Meta::CPAN

my $expected_redacted_caller_information =
[
	[],
	[
		'Mr. Spock',
		'[redacted]',
		'12',
		'2012',
	],
	[],
	[ "CODE(0xb3d4f48)", "Try::Tiny::Finally=REF(0xaf503f0)" ],
];

subtest(
	'Sensitive information is redacted out.',
	sub
	{
		plan( tests => scalar( @$expected_redacted_caller_information ) );
		
		for ( my $i = 0; $i < scalar( @$expected_redacted_caller_information ); $i++ )
		{

t/11-parse_stack_trace-regexp.t  view on Meta::CPAN

	},
);


__DATA__
Test.
at test/lib/Spock/test.t line 116
main::test_trace('Mr. Spock', '4111111111111111', '12', '2012') called at test/lib/Spock/test.t line 61
main::__ANON__() called at /home/spock/site_perl/5.14.2/Try/Tiny.pm line 76
eval {...} called at /home/spock/site_perl/5.14.2/Try/Tiny.pm line 67
Try::Tiny::try('CODE(0xb3d4f48)', 'Try::Tiny::Finally=REF(0xaf503f0)') called at test/lib/Spock/test.t line 69

t/12-parse_stack_trace-indentation.t  view on Meta::CPAN

use Data::Dump;
use Test::Exception;
use Test::More tests => 2;


# The test stack trace, along with the indentation of callers.
my $stack_trace = q|Test at test/lib/Spock/test.t line 116
        main::test_trace('gift_message', 'Happy Birthday from Timmy', 'password', 'thereisnotry', 'planet', 'degobah', 'ship_zip', 01138, 'username', 'yoda') called at test/lib/Spock/test.t line 61
        main::__ANON__() called at /home/spock/site_perl/5.14.2/Try/Tiny.pm line 76
        eval {...} called at /home/spock/site_perl/5.14.2/Try/Tiny.pm line 67
        Try::Tiny::try('CODE(0xb3d4f48)', 'Try::Tiny::Finally=REF(0xaf503f0)') called at test/lib/Spock/test.t line 69
|;

# The expected redacted lines.
# Note: tabs are for formatting of this array only, they are removed before
# comparing expected vs output.
my $expected_redacted_lines =
[
	q|Test at test/lib/Spock/test.t line 116|,
	q|        main::test_trace(
		          "gift_message",

t/12-parse_stack_trace-indentation.t  view on Meta::CPAN

		          "password",
		          "[redacted]",
		          "planet",
		          "degobah",
		          "ship_zip",
		          "[redacted]",
		          "username",
		          "[redacted]",
		        ) called at test/lib/Spock/test.t line 61|,
	q|        main::__ANON__() called at /home/spock/site_perl/5.14.2/Try/Tiny.pm line 76|,
	q|        Try::Tiny::try("CODE(0xb3d4f48)", "Try::Tiny::Finally=REF(0xaf503f0)") called at test/lib/Spock/test.t line 69|,
];

my $parsed_stack_trace;
lives_ok(
	sub
	{
		$parsed_stack_trace = Carp::Parse::Redact::parse_stack_trace(
			$stack_trace,
			sensitive_argument_names =>
			[



( run in 1.038 second using v1.01-cache-2.11-cpan-05444aca049 )