Skip to content

Commit

Permalink
refactor: adding perltidy to files (#7070)
Browse files Browse the repository at this point in the history
Implementing perltidy to t/dataquality.t , t/dataqualityfood.t , t/export.t
  • Loading branch information
dipietroR committed Jul 15, 2022
1 parent 67c3c74 commit c11ca17
Show file tree
Hide file tree
Showing 4 changed files with 277 additions and 139 deletions.
3 changes: 0 additions & 3 deletions .perltidy_excludes
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ t/additives_tags.t
t/allergens.t
t/allergens_tags.t
t/attributes.t
t/dataquality.t
t/dataqualityfood.t
t/export.t
t/food_groups.t
t/forest_footprint.t
t/i18n.t
Expand Down
161 changes: 114 additions & 47 deletions t/dataquality.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ sub check_quality_and_test_product_has_quality_tag($$$$) {
my $reason = shift;
my $yesno = shift;
ProductOpener::DataQuality::check_quality($product_ref);
if ($yesno){
ok( has_tag($product_ref, 'data_quality', $tag), $reason ) or diag explain $product_ref;
if ($yesno) {
ok(has_tag($product_ref, 'data_quality', $tag), $reason) or diag explain $product_ref;
}
else {
ok( !has_tag($product_ref, 'data_quality', $tag), $reason ) or diag explain $product_ref;
ok(!has_tag($product_ref, 'data_quality', $tag), $reason) or diag explain $product_ref;
}

return;
Expand All @@ -30,66 +30,133 @@ sub product_with_code_has_quality_tag($$$$) {
my $reason = shift;
my $yesno = shift;

my $product_ref = {
code => $code
};
my $product_ref = {code => $code};

check_quality_and_test_product_has_quality_tag($product_ref, $tag, $reason, $yesno);

return;
}


# gs1-issn-prefix
product_with_code_has_quality_tag('977000000000', 'en:gs1-issn-prefix', 'product with GTIN-12 has gs1-issn-prefix tag because of the barcode prefix 977', 1);
product_with_code_has_quality_tag('9770000000000', 'en:gs1-issn-prefix', 'product with GTIN-13 has gs1-issn-prefix tag because of the barcode prefix 977', 1);
product_with_code_has_quality_tag('976000000000', 'en:gs1-issn-prefix', 'product with GTIN-12 has no gs1-issn-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('9760000000000', 'en:gs1-issn-prefix', 'product with GTIN-13 has no gs1-issn-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('977000000000', 'en:gs1-issn-prefix',
'product with GTIN-12 has gs1-issn-prefix tag because of the barcode prefix 977', 1);
product_with_code_has_quality_tag('9770000000000', 'en:gs1-issn-prefix',
'product with GTIN-13 has gs1-issn-prefix tag because of the barcode prefix 977', 1);
product_with_code_has_quality_tag('976000000000', 'en:gs1-issn-prefix',
'product with GTIN-12 has no gs1-issn-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('9760000000000', 'en:gs1-issn-prefix',
'product with GTIN-13 has no gs1-issn-prefix tag because of the barcode prefix 976', 0);

# gs1-isbn-prefix
product_with_code_has_quality_tag('978000000000', 'en:gs1-isbn-prefix', 'product with GTIN-12 has gs1-isbn-prefix tag because of the barcode prefix 978', 1);
product_with_code_has_quality_tag('9780000000000', 'en:gs1-isbn-prefix', 'product with GTIN-13 has gs1-isbn-prefix tag because of the barcode prefix 978', 1);
product_with_code_has_quality_tag('979000000000', 'en:gs1-isbn-prefix', 'product with GTIN-12 has gs1-isbn-prefix tag because of the barcode prefix 979', 1);
product_with_code_has_quality_tag('9790000000000', 'en:gs1-isbn-prefix', 'product with GTIN-13 has gs1-isbn-prefix tag because of the barcode prefix 979', 1);
product_with_code_has_quality_tag('976000000000', 'en:gs1-isbn-prefix', 'product with GTIN-12 has no gs1-isbn-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('9760000000000', 'en:gs1-isbn-prefix', 'product with GTIN-13 has no gs1-isbn-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('978000000000', 'en:gs1-isbn-prefix',
'product with GTIN-12 has gs1-isbn-prefix tag because of the barcode prefix 978', 1);
product_with_code_has_quality_tag('9780000000000', 'en:gs1-isbn-prefix',
'product with GTIN-13 has gs1-isbn-prefix tag because of the barcode prefix 978', 1);
product_with_code_has_quality_tag('979000000000', 'en:gs1-isbn-prefix',
'product with GTIN-12 has gs1-isbn-prefix tag because of the barcode prefix 979', 1);
product_with_code_has_quality_tag('9790000000000', 'en:gs1-isbn-prefix',
'product with GTIN-13 has gs1-isbn-prefix tag because of the barcode prefix 979', 1);
product_with_code_has_quality_tag('976000000000', 'en:gs1-isbn-prefix',
'product with GTIN-12 has no gs1-isbn-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('9760000000000', 'en:gs1-isbn-prefix',
'product with GTIN-13 has no gs1-isbn-prefix tag because of the barcode prefix 976', 0);

# gs1-refund-prefix
product_with_code_has_quality_tag('980000000000', 'en:gs1-refund-prefix', 'product with GTIN-12 has gs1-refund-prefix tag because of the barcode prefix 980', 1);
product_with_code_has_quality_tag('9800000000000', 'en:gs1-refund-prefix', 'product with GTIN-13 has gs1-refund-prefix tag because of the barcode prefix 980', 1);
product_with_code_has_quality_tag('976000000000', 'en:gs1-refund-prefix', 'product with GTIN-12 has no gs1-refund-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('9760000000000', 'en:gs1-refund-prefix', 'product with GTIN-13 has no gs1-refund-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('980000000000', 'en:gs1-refund-prefix',
'product with GTIN-12 has gs1-refund-prefix tag because of the barcode prefix 980', 1);
product_with_code_has_quality_tag('9800000000000', 'en:gs1-refund-prefix',
'product with GTIN-13 has gs1-refund-prefix tag because of the barcode prefix 980', 1);
product_with_code_has_quality_tag('976000000000', 'en:gs1-refund-prefix',
'product with GTIN-12 has no gs1-refund-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('9760000000000', 'en:gs1-refund-prefix',
'product with GTIN-13 has no gs1-refund-prefix tag because of the barcode prefix 976', 0);

# gs1-coupon-common-currency-area-prefix
product_with_code_has_quality_tag('981000000000', 'en:gs1-coupon-common-currency-area-prefix', 'product with GTIN-12 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 981', 1);
product_with_code_has_quality_tag('9810000000000', 'en:gs1-coupon-common-currency-area-prefix', 'product with GTIN-13 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 981', 1);
product_with_code_has_quality_tag('982000000000', 'en:gs1-coupon-common-currency-area-prefix', 'product with GTIN-12 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 982', 1);
product_with_code_has_quality_tag('9820000000000', 'en:gs1-coupon-common-currency-area-prefix', 'product with GTIN-13 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 982', 1);
product_with_code_has_quality_tag('983000000000', 'en:gs1-coupon-common-currency-area-prefix', 'product with GTIN-12 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 983', 1);
product_with_code_has_quality_tag('9830000000000', 'en:gs1-coupon-common-currency-area-prefix', 'product with GTIN-13 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 983', 1);
product_with_code_has_quality_tag('984000000000', 'en:gs1-coupon-common-currency-area-prefix', 'product with GTIN-12 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 984', 1);
product_with_code_has_quality_tag('9840000000000', 'en:gs1-coupon-common-currency-area-prefix', 'product with GTIN-13 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 984', 1);
product_with_code_has_quality_tag('976000000000', 'en:gs1-coupon-common-currency-area-prefix', 'product with GTIN-12 has no gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('9760000000000', 'en:gs1-coupon-common-currency-area-prefix', 'product with GTIN-13 has no gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag(
'981000000000',
'en:gs1-coupon-common-currency-area-prefix',
'product with GTIN-12 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 981', 1
);
product_with_code_has_quality_tag(
'9810000000000',
'en:gs1-coupon-common-currency-area-prefix',
'product with GTIN-13 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 981', 1
);
product_with_code_has_quality_tag(
'982000000000',
'en:gs1-coupon-common-currency-area-prefix',
'product with GTIN-12 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 982', 1
);
product_with_code_has_quality_tag(
'9820000000000',
'en:gs1-coupon-common-currency-area-prefix',
'product with GTIN-13 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 982', 1
);
product_with_code_has_quality_tag(
'983000000000',
'en:gs1-coupon-common-currency-area-prefix',
'product with GTIN-12 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 983', 1
);
product_with_code_has_quality_tag(
'9830000000000',
'en:gs1-coupon-common-currency-area-prefix',
'product with GTIN-13 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 983', 1
);
product_with_code_has_quality_tag(
'984000000000',
'en:gs1-coupon-common-currency-area-prefix',
'product with GTIN-12 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 984', 1
);
product_with_code_has_quality_tag(
'9840000000000',
'en:gs1-coupon-common-currency-area-prefix',
'product with GTIN-13 has gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 984', 1
);
product_with_code_has_quality_tag(
'976000000000',
'en:gs1-coupon-common-currency-area-prefix',
'product with GTIN-12 has no gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 976', 0
);
product_with_code_has_quality_tag(
'9760000000000',
'en:gs1-coupon-common-currency-area-prefix',
'product with GTIN-13 has no gs1-coupon-common-currency-area-prefix tag because of the barcode prefix 976', 0
);

# gs1-future-coupon-prefix
product_with_code_has_quality_tag('985000000000', 'en:gs1-future-coupon-prefix', 'product with GTIN-12 has gs1-future-coupon-prefix tag because of the barcode prefix 985', 1);
product_with_code_has_quality_tag('9850000000000', 'en:gs1-future-coupon-prefix', 'product with GTIN-13 has gs1-future-coupon-prefix tag because of the barcode prefix 985', 1);
product_with_code_has_quality_tag('986000000000', 'en:gs1-future-coupon-prefix', 'product with GTIN-12 has gs1-future-coupon-prefix tag because of the barcode prefix 986', 1);
product_with_code_has_quality_tag('9860000000000', 'en:gs1-future-coupon-prefix', 'product with GTIN-13 has gs1-future-coupon-prefix tag because of the barcode prefix 986', 1);
product_with_code_has_quality_tag('987000000000', 'en:gs1-future-coupon-prefix', 'product with GTIN-12 has gs1-future-coupon-prefix tag because of the barcode prefix 987', 1);
product_with_code_has_quality_tag('9870000000000', 'en:gs1-future-coupon-prefix', 'product with GTIN-13 has gs1-future-coupon-prefix tag because of the barcode prefix 987', 1);
product_with_code_has_quality_tag('988000000000', 'en:gs1-future-coupon-prefix', 'product with GTIN-12 has gs1-future-coupon-prefix tag because of the barcode prefix 988', 1);
product_with_code_has_quality_tag('9880000000000', 'en:gs1-future-coupon-prefix', 'product with GTIN-13 has gs1-future-coupon-prefix tag because of the barcode prefix 988', 1);
product_with_code_has_quality_tag('989000000000', 'en:gs1-future-coupon-prefix', 'product with GTIN-12 has gs1-future-coupon-prefix tag because of the barcode prefix 989', 1);
product_with_code_has_quality_tag('9890000000000', 'en:gs1-future-coupon-prefix', 'product with GTIN-13 has gs1-future-coupon-prefix tag because of the barcode prefix 989', 1);
product_with_code_has_quality_tag('976000000000', 'en:gs1-future-coupon-prefix', 'product with GTIN-12 has no gs1-future-coupon-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('9760000000000', 'en:gs1-future-coupon-prefix', 'product with GTIN-13 has no gs1-future-coupon-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('985000000000', 'en:gs1-future-coupon-prefix',
'product with GTIN-12 has gs1-future-coupon-prefix tag because of the barcode prefix 985', 1);
product_with_code_has_quality_tag('9850000000000', 'en:gs1-future-coupon-prefix',
'product with GTIN-13 has gs1-future-coupon-prefix tag because of the barcode prefix 985', 1);
product_with_code_has_quality_tag('986000000000', 'en:gs1-future-coupon-prefix',
'product with GTIN-12 has gs1-future-coupon-prefix tag because of the barcode prefix 986', 1);
product_with_code_has_quality_tag('9860000000000', 'en:gs1-future-coupon-prefix',
'product with GTIN-13 has gs1-future-coupon-prefix tag because of the barcode prefix 986', 1);
product_with_code_has_quality_tag('987000000000', 'en:gs1-future-coupon-prefix',
'product with GTIN-12 has gs1-future-coupon-prefix tag because of the barcode prefix 987', 1);
product_with_code_has_quality_tag('9870000000000', 'en:gs1-future-coupon-prefix',
'product with GTIN-13 has gs1-future-coupon-prefix tag because of the barcode prefix 987', 1);
product_with_code_has_quality_tag('988000000000', 'en:gs1-future-coupon-prefix',
'product with GTIN-12 has gs1-future-coupon-prefix tag because of the barcode prefix 988', 1);
product_with_code_has_quality_tag('9880000000000', 'en:gs1-future-coupon-prefix',
'product with GTIN-13 has gs1-future-coupon-prefix tag because of the barcode prefix 988', 1);
product_with_code_has_quality_tag('989000000000', 'en:gs1-future-coupon-prefix',
'product with GTIN-12 has gs1-future-coupon-prefix tag because of the barcode prefix 989', 1);
product_with_code_has_quality_tag('9890000000000', 'en:gs1-future-coupon-prefix',
'product with GTIN-13 has gs1-future-coupon-prefix tag because of the barcode prefix 989', 1);
product_with_code_has_quality_tag('976000000000', 'en:gs1-future-coupon-prefix',
'product with GTIN-12 has no gs1-future-coupon-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('9760000000000', 'en:gs1-future-coupon-prefix',
'product with GTIN-13 has no gs1-future-coupon-prefix tag because of the barcode prefix 976', 0);

# gs1-coupon-prefix
product_with_code_has_quality_tag('990000000000', 'en:gs1-coupon-prefix', 'product with GTIN-12 has gs1-coupon-prefix tag because of the barcode prefix 99', 1);
product_with_code_has_quality_tag('9900000000000', 'en:gs1-coupon-prefix', 'product with GTIN-13 has gs1-coupon-prefix tag because of the barcode prefix 99', 1);
product_with_code_has_quality_tag('976000000000', 'en:gs1-coupon-prefix', 'product with GTIN-12 has no gs1-coupon-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('9760000000000', 'en:gs1-coupon-prefix', 'product with GTIN-13 has no gs1-coupon-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('990000000000', 'en:gs1-coupon-prefix',
'product with GTIN-12 has gs1-coupon-prefix tag because of the barcode prefix 99', 1);
product_with_code_has_quality_tag('9900000000000', 'en:gs1-coupon-prefix',
'product with GTIN-13 has gs1-coupon-prefix tag because of the barcode prefix 99', 1);
product_with_code_has_quality_tag('976000000000', 'en:gs1-coupon-prefix',
'product with GTIN-12 has no gs1-coupon-prefix tag because of the barcode prefix 976', 0);
product_with_code_has_quality_tag('9760000000000', 'en:gs1-coupon-prefix',
'product with GTIN-13 has no gs1-coupon-prefix tag because of the barcode prefix 976', 0);

done_testing();
Loading

0 comments on commit c11ca17

Please sign in to comment.