Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanegigandet committed Jun 28, 2023
1 parent 6f93f87 commit a167909
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 81 deletions.
11 changes: 9 additions & 2 deletions lib/ProductOpener/Ingredients.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1804,8 +1804,15 @@ sub parse_ingredients_text ($product_ref) {
)

# match before or after the ingredient, does not require a space
or ( (($product_lc eq 'de') or ($product_lc eq 'hu') or ($product_lc eq 'ja') or ($product_lc eq 'nl'))
and ($new_ingredient =~ /(^($regexp)|($regexp)$)/i))
or (
(
($product_lc eq 'de')
or ($product_lc eq 'hu')
or ($product_lc eq 'ja')
or ($product_lc eq 'nl')
)
and ($new_ingredient =~ /(^($regexp)|($regexp)$)/i)
)

# match after the ingredient, does not require a space
# match before the ingredient, require a space
Expand Down
158 changes: 79 additions & 79 deletions tests/unit/ingredients_processing.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use utf8;
use Test::More;

my $builder = Test::More->builder;
binmode $builder->output, ":encoding(utf8)";
binmode $builder->output, ":encoding(utf8)";
binmode $builder->failure_output, ":encoding(utf8)";
binmode $builder->todo_output, ":encoding(utf8)";
binmode $builder->todo_output, ":encoding(utf8)";

#use Log::Any::Adapter 'TAP';
use Log::Any::Adapter 'TAP', filter => 'trace';
Expand Down Expand Up @@ -1662,84 +1662,84 @@ my @tests = (
{
lc => "ja",
ingredients_text =>
# sliced
"スライスアーモンド, "
#powder
. "酵母エキスパウダー, クリーミングパウダー, "
#powder
. "昆布粉末, 粉末醤油, 粉末酒, かつお節粉末, マカ粉末, 粉末しょうゆ, 発酵黒にんにく末, "
# roasted
. "ローストバターパウダー, ロースト-麦芽,"
# fried garlic powder
. "フライドガーリックパウダー, "
# pulp
. "りんごパルプ, "
# sliced
"スライスアーモンド, "
#powder
. "酵母エキスパウダー, クリーミングパウダー, "
#powder
. "昆布粉末, 粉末醤油, 粉末酒, かつお節粉末, マカ粉末, 粉末しょうゆ, 発酵黒にんにく末, "
# roasted
. "ローストバターパウダー, ロースト-麦芽,"
# fried garlic powder
. "フライドガーリックパウダー, "
# pulp
. "りんごパルプ, "
},
[
{
'id' => 'en:flaked-almonds',
'text' => "\x{30b9}\x{30e9}\x{30a4}\x{30b9}\x{30a2}\x{30fc}\x{30e2}\x{30f3}\x{30c9}"
},
{
'id' => 'en:yeast-extract-powder',
'text' => "\x{9175}\x{6bcd}\x{30a8}\x{30ad}\x{30b9}\x{30d1}\x{30a6}\x{30c0}\x{30fc}"
},
{
'id' => "ja:\x{30af}\x{30ea}\x{30fc}\x{30df}\x{30f3}\x{30b0}\x{30d1}\x{30a6}\x{30c0}\x{30fc}",
'text' => "\x{30af}\x{30ea}\x{30fc}\x{30df}\x{30f3}\x{30b0}\x{30d1}\x{30a6}\x{30c0}\x{30fc}"
},
{
'id' => 'en:kombu',
'processing' => 'en:powder',
'text' => "\x{6606}\x{5e03}"
},
{
'id' => 'en:soy-sauce',
'processing' => 'en:powder',
'text' => "\x{91a4}\x{6cb9}"
},
{
'id' => "ja:\x{7c89}\x{672b}\x{9152}",
'text' => "\x{7c89}\x{672b}\x{9152}"
},
{
'id' => 'en:bonito-flakes',
'processing' => 'en:powder',
'text' => "\x{304b}\x{3064}\x{304a}\x{7bc0}"
},
{
'id' => "ja:\x{30de}\x{30ab}\x{7c89}\x{672b}",
'text' => "\x{30de}\x{30ab}\x{7c89}\x{672b}"
},
{
'id' => 'en:soy-sauce',
'processing' => 'en:powder',
'text' => "\x{3057}\x{3087}\x{3046}\x{3086}"
},
{
'id' => "ja:\x{767a}\x{9175}\x{9ed2}\x{306b}\x{3093}\x{306b}\x{304f}\x{672b}",
'text' => "\x{767a}\x{9175}\x{9ed2}\x{306b}\x{3093}\x{306b}\x{304f}\x{672b}"
},
{
'id' => 'en:butter',
'processing' => 'en:powder, en:roasted',
'text' => "\x{30d0}\x{30bf}\x{30fc}"
},
{
'id' => 'en:malt',
'processing' => 'en:roasted',
'text' => "\x{9ea6}\x{82bd}"
},
{
'id' => 'en:garlic',
'processing' => 'en:powder, en:fried',
'text' => "\x{30ac}\x{30fc}\x{30ea}\x{30c3}\x{30af}"
},
{
'id' => 'en:apple-pulp',
'text' => "\x{308a}\x{3093}\x{3054}\x{30d1}\x{30eb}\x{30d7}"
}
]
[
{
'id' => 'en:flaked-almonds',
'text' => "\x{30b9}\x{30e9}\x{30a4}\x{30b9}\x{30a2}\x{30fc}\x{30e2}\x{30f3}\x{30c9}"
},
{
'id' => 'en:yeast-extract-powder',
'text' => "\x{9175}\x{6bcd}\x{30a8}\x{30ad}\x{30b9}\x{30d1}\x{30a6}\x{30c0}\x{30fc}"
},
{
'id' => "ja:\x{30af}\x{30ea}\x{30fc}\x{30df}\x{30f3}\x{30b0}\x{30d1}\x{30a6}\x{30c0}\x{30fc}",
'text' => "\x{30af}\x{30ea}\x{30fc}\x{30df}\x{30f3}\x{30b0}\x{30d1}\x{30a6}\x{30c0}\x{30fc}"
},
{
'id' => 'en:kombu',
'processing' => 'en:powder',
'text' => "\x{6606}\x{5e03}"
},
{
'id' => 'en:soy-sauce',
'processing' => 'en:powder',
'text' => "\x{91a4}\x{6cb9}"
},
{
'id' => "ja:\x{7c89}\x{672b}\x{9152}",
'text' => "\x{7c89}\x{672b}\x{9152}"
},
{
'id' => 'en:bonito-flakes',
'processing' => 'en:powder',
'text' => "\x{304b}\x{3064}\x{304a}\x{7bc0}"
},
{
'id' => "ja:\x{30de}\x{30ab}\x{7c89}\x{672b}",
'text' => "\x{30de}\x{30ab}\x{7c89}\x{672b}"
},
{
'id' => 'en:soy-sauce',
'processing' => 'en:powder',
'text' => "\x{3057}\x{3087}\x{3046}\x{3086}"
},
{
'id' => "ja:\x{767a}\x{9175}\x{9ed2}\x{306b}\x{3093}\x{306b}\x{304f}\x{672b}",
'text' => "\x{767a}\x{9175}\x{9ed2}\x{306b}\x{3093}\x{306b}\x{304f}\x{672b}"
},
{
'id' => 'en:butter',
'processing' => 'en:powder, en:roasted',
'text' => "\x{30d0}\x{30bf}\x{30fc}"
},
{
'id' => 'en:malt',
'processing' => 'en:roasted',
'text' => "\x{9ea6}\x{82bd}"
},
{
'id' => 'en:garlic',
'processing' => 'en:powder, en:fried',
'text' => "\x{30ac}\x{30fc}\x{30ea}\x{30c3}\x{30af}"
},
{
'id' => 'en:apple-pulp',
'text' => "\x{308a}\x{3093}\x{3054}\x{30d1}\x{30eb}\x{30d7}"
}
]

],
);
Expand Down

0 comments on commit a167909

Please sign in to comment.