| 1 | package Test::OpenTracing::Interface::ContextReference; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Test::OpenTracing::Interface::ContextReference - compliance testing | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use Test::OpenTracing::Interface::ContextReference qw/:all/; | ||
| 10 | |||
| 11 | can_all_ok 'MyImplementation::ContextReference', | ||
| 12 | "MyImplementation class does have all subs defined, well done!"; | ||
| 13 | |||
| 14 | my $mocked_span_context = bless {}, 'MyImplementation::SpanContext'; | ||
| 15 | # | ||
| 16 | # calling `new` reuires other dependencies | ||
| 17 | |||
| 18 | my $test_thing = MyImplementation::ContextReference | ||
| 19 | ->new_child_of( $mocked_span_context ); | ||
| 20 | |||
| 21 | can_all_ok( $test_thing, | ||
| 22 | "An object returned by 'new_child_of' has all required subs defined" | ||
| 23 | ); | ||
| 24 | |||
| 25 | =cut | ||
| 26 | |||
| 27 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 29 | |||
| 30 | 3 | our $VERSION = 'v0.23.1'; | |
| 31 | |||
| 32 | |||
| 33 | 3 | ▶ | use Test::OpenTracing::Interface; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 34 | |||
| 35 | 3 | ▶ | use Exporter qw/import/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | |||
| 37 | 3 | our @EXPORT_OK = qw/can_all_ok/; | |
| 38 | 3 | our %EXPORT_TAGS = ( all => [qw/can_all_ok/] ); | |
| 39 | |||
| 40 | 3 | ▶ | use syntax qw/maybe/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 41 | |||
| 42 | |||
| 43 | |||
| 44 | =head1 DESCRIPTION | ||
| 45 | |||
| 46 | This package will provide the tests as described in | ||
| 47 | L<Test::OpenTracing::Interface>. | ||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | =head1 EXPORTED SUBROUTINES | ||
| 52 | |||
| 53 | =cut | ||
| 54 | |||
| 55 | |||
| 56 | |||
| 57 | =head2 C<can_all_ok> | ||
| 58 | |||
| 59 | Test that all methods mentioned in L<OpenTracing::Interface::ContextReference> | ||
| 60 | are defined. | ||
| 61 | |||
| 62 | =cut | ||
| 63 | |||
| 64 | 3 | ▶ | sub can_all_ok { |
|
Subroutine
can_all_ok: called CC=1 SCAR=0.0
Pod
documented
| |||
| 65 | 3 | my $thing = shift; | |
| 66 | 3 | my $message = shift; | |
| 67 | |||
| 68 | 3 | my $Test = Test::OpenTracing::Interface::CanAll->new( | |
| 69 | test_this => $thing, | ||
| 70 | interface_name => 'ContextReference', | ||
| 71 | interface_methods => [ | ||
| 72 | 'new_child_of', | ||
| 73 | 'new_follows_from', | ||
| 74 | 'get_referenced_context', | ||
| 75 | 'type_is_child_of', | ||
| 76 | 'type_is_follows_from', | ||
| 77 | ], | ||
| 78 | maybe | ||
| 79 | message => $message, | ||
| 80 | ); | ||
| 81 | |||
| 82 | 3 | return $Test->run_tests; | |
| 83 | } | ||
| 84 | |||
| 85 | |||
| 86 | |||
| 87 | =head1 SEE ALSO | ||
| 88 | |||
| 89 | =over | ||
| 90 | |||
| 91 | =item L<Test::OpenTracing::Interface> | ||
| 92 | |||
| 93 | Test OpenTracing::Interface compliance. | ||
| 94 | |||
| 95 | =item L<OpenTracing::Interface::ContextReference> | ||
| 96 | |||
| 97 | Defines the ContextReference. | ||
| 98 | |||
| 99 | =back | ||
| 100 | |||
| 101 | |||
| 102 | |||
| 103 | =head1 AUTHOR | ||
| 104 | |||
| 105 | Theo van Hoesel <tvanhoesel@perceptyx.com> | ||
| 106 | |||
| 107 | |||
| 108 | |||
| 109 | =head1 COPYRIGHT AND LICENSE | ||
| 110 | |||
| 111 | 'Test OpenTracing' is Copyright (C) 2020, Perceptyx Inc | ||
| 112 | |||
| 113 | This library is free software; you can redistribute it and/or modify it under | ||
| 114 | the terms of the Artistic License 2.0. | ||
| 115 | |||
| 116 | This library is distributed in the hope that it will be useful, but it is | ||
| 117 | provided "as is" and without any express or implied warranties. | ||
| 118 | |||
| 119 | For details, see the full text of the license in the file LICENSE. | ||
| 120 | |||
| 121 | |||
| 122 | |||
| 123 | =cut | ||
| 124 | |||
| 125 | 3 | 1; | |