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