1use strict; 2use warnings; 3 4use Test2::Tools::Tiny; 5use Test2::Event::Note; 6use Test2::EventFacet::Trace; 7 8my $note = Test2::Event::Note->new( 9 trace => Test2::EventFacet::Trace->new(frame => [__PACKAGE__, __FILE__, __LINE__]), 10 message => 'foo', 11); 12 13is($note->summary, 'foo', "summary is just message"); 14 15$note = Test2::Event::Note->new( 16 trace => Test2::EventFacet::Trace->new(frame => [__PACKAGE__, __FILE__, __LINE__]), 17 message => undef, 18); 19 20is($note->message, 'undef', "set undef message to undef"); 21is($note->summary, 'undef', "summary is just message even when undef"); 22 23$note = Test2::Event::Note->new( 24 trace => Test2::EventFacet::Trace->new(frame => [__PACKAGE__, __FILE__, __LINE__]), 25 message => {}, 26); 27 28like($note->message, qr/^HASH\(.*\)$/, "stringified the input value"); 29 30$note = Test2::Event::Note->new( 31 trace => Test2::EventFacet::Trace->new(frame => [__PACKAGE__, __FILE__, __LINE__]), 32 message => 'Hi there', 33); 34 35my $facet_data = $note->facet_data; 36ok($facet_data->{about}, "Got 'about' from common"); 37ok($facet_data->{trace}, "Got 'trace' from common"); 38 39is_deeply( 40 $facet_data->{info}, 41 [{ 42 tag => 'NOTE', 43 debug => 0, 44 details => 'Hi there', 45 }], 46 "Got info facet" 47); 48 49 50done_testing; 51