| 1 | package Test::BDD::Cucumber::Definitions::Struct::In; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use utf8; | ||
| 6 | |||
| 7 | use Test::BDD::Cucumber::Definitions qw(Given When Then); | ||
| 8 | use Test::BDD::Cucumber::Definitions::Struct qw(Struct); | ||
| 9 | |||
| 10 | our $VERSION = '0.41'; | ||
| 11 | |||
| 12 | ## no critic [RegularExpressions::ProhibitCaptureWithoutTest] | ||
| 13 | ## no critic [RegularExpressions::RequireExtendedFormatting] | ||
| 14 | ## no critic [RegularExpressions::ProhibitComplexRegexes] | ||
| 15 | |||
| 16 | sub import { | ||
| 17 | |||
| 18 | # read http response content as JSON | ||
| 19 | Given qr/read http response content as JSON/, sub { | ||
| 20 | Struct->read_http_response_content_as_json(); | ||
| 21 | }; | ||
| 22 | |||
| 23 | # read file content as JSON | ||
| 24 | Given qr/read file content as JSON/, sub { | ||
| 25 | Struct->read_file_content_as_json(); | ||
| 26 | }; | ||
| 27 | |||
| 28 | # read zip archive members as list | ||
| 29 | Given qr/read zip archive members as list/, sub { | ||
| 30 | Struct->read_zip_archive_members_as_list(); | ||
| 31 | }; | ||
| 32 | |||
| 33 | # read base response as struct | ||
| 34 | Given qr/read base response as struct/, sub { | ||
| 35 | Struct->read_base_response_as_struct(); | ||
| 36 | }; | ||
| 37 | |||
| 38 | # struct data element "(.+?)" eq "(.*)" | ||
| 39 | Then qr/struct data element "(.+?)" eq "(.*)"/, sub { | ||
| 40 | Struct->data_element_eq( $1, $2 ); | ||
| 41 | }; | ||
| 42 | |||
| 43 | # struct data list "(.+?)" any eq "(.*)" | ||
| 44 | Then qr/struct data list "(.+?)" any eq "(.*)"/, sub { | ||
| 45 | Struct->data_list_any_eq( $1, $2 ); | ||
| 46 | }; | ||
| 47 | |||
| 48 | # struct data element "(.+?)" re "(.*)" | ||
| 49 | Then qr/struct data element "(.+?)" re "(.*)"/, sub { | ||
| 50 | Struct->data_element_re( $1, $2 ); | ||
| 51 | }; | ||
| 52 | |||
| 53 | # struct data list "(.+?)" any re "(.*)" | ||
| 54 | Then qr/struct data list "(.+?)" any re "(.*)"/, sub { | ||
| 55 | Struct->data_list_any_re( $1, $2 ); | ||
| 56 | }; | ||
| 57 | |||
| 58 | # struct data list "(.+?)" count "(.*)" | ||
| 59 | Then qr/struct data list "(.+?)" count "(.*)"/, sub { | ||
| 60 | Struct->data_list_count( $1, $2 ); | ||
| 61 | }; | ||
| 62 | |||
| 63 | # struct data element "(.+?)" key "(.*)" | ||
| 64 | Then qr/struct data element "(.+?)" key "(.*)"/, sub { | ||
| 65 | Struct->data_element_key( $1, $2 ); | ||
| 66 | }; | ||
| 67 | |||
| 68 | # struct data list "(.+?)" all key "(.*)" | ||
| 69 | Then qr/struct data list "(.+?)" all key "(.*)"/, sub { | ||
| 70 | Struct->data_list_all_key( $1, $2 ); | ||
| 71 | }; | ||
| 72 | |||
| 73 | return; | ||
| 74 | } | ||
| 75 | |||
| 76 | 1; |