1*5759b3d2Safresh1use strict; 2*5759b3d2Safresh1use warnings; 3*5759b3d2Safresh1use Test2::Tools::Tiny; 4*5759b3d2Safresh1use Test2::EventFacet::Trace; 5*5759b3d2Safresh1 6*5759b3d2Safresh1like( 7*5759b3d2Safresh1 exception { 'Test2::EventFacet::Trace'->new() }, 8*5759b3d2Safresh1 qr/The 'frame' attribute is required/, 9*5759b3d2Safresh1 "got error" 10*5759b3d2Safresh1); 11*5759b3d2Safresh1 12*5759b3d2Safresh1my $one = 'Test2::EventFacet::Trace'->new(frame => ['Foo::Bar', 'foo.t', 5, 'Foo::Bar::foo']); 13*5759b3d2Safresh1is_deeply($one->frame, ['Foo::Bar', 'foo.t', 5, 'Foo::Bar::foo'], "Got frame"); 14*5759b3d2Safresh1is_deeply([$one->call], ['Foo::Bar', 'foo.t', 5, 'Foo::Bar::foo'], "Got call"); 15*5759b3d2Safresh1is($one->package, 'Foo::Bar', "Got package"); 16*5759b3d2Safresh1is($one->file, 'foo.t', "Got file"); 17*5759b3d2Safresh1is($one->line, 5, "Got line"); 18*5759b3d2Safresh1is($one->subname, 'Foo::Bar::foo', "got subname"); 19*5759b3d2Safresh1 20*5759b3d2Safresh1is($one->debug, "at foo.t line 5", "got trace"); 21*5759b3d2Safresh1$one->set_detail("yo momma"); 22*5759b3d2Safresh1is($one->debug, "yo momma", "got detail for trace"); 23*5759b3d2Safresh1$one->set_detail(undef); 24*5759b3d2Safresh1 25*5759b3d2Safresh1is( 26*5759b3d2Safresh1 exception { $one->throw('I died') }, 27*5759b3d2Safresh1 "I died at foo.t line 5.\n", 28*5759b3d2Safresh1 "got exception" 29*5759b3d2Safresh1); 30*5759b3d2Safresh1 31*5759b3d2Safresh1is_deeply( 32*5759b3d2Safresh1 warnings { $one->alert('I cried') }, 33*5759b3d2Safresh1 [ "I cried at foo.t line 5.\n" ], 34*5759b3d2Safresh1 "alter() warns" 35*5759b3d2Safresh1); 36*5759b3d2Safresh1 37*5759b3d2Safresh1my $snap = $one->snapshot; 38*5759b3d2Safresh1is_deeply($snap, $one, "identical"); 39*5759b3d2Safresh1ok($snap != $one, "Not the same instance"); 40*5759b3d2Safresh1 41*5759b3d2Safresh1done_testing; 42