Skip to content

Commit

Permalink
try to debug failing tags tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanegigandet committed May 27, 2019
1 parent 429bc29 commit 50c1258
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/ProductOpener/Tags.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ BEGIN
%tags_images
%tags_texts
%tags_levels
%levels
%level
%special_tags
&get_taxonomyid
Expand Down Expand Up @@ -187,7 +187,7 @@ my %synonyms = ();
my %synonyms_for_extended = ();
%translations_from = ();
%translations_to = ();
my %level = ();
%level = ();
my %direct_parents = ();
my %direct_children = ();
my %all_parents = ();
Expand Down Expand Up @@ -1773,6 +1773,7 @@ sub gen_tags_hierarchy_taxonomy($$$) {
}

my @sorted_list = sort { (((defined $level{$tagtype}{$b}) ? $level{$tagtype}{$b} : 0) <=> ((defined $level{$tagtype}{$a}) ? $level{$tagtype}{$a} : 0)) || ($a cmp $b) } keys %tags;

return @sorted_list;
}

Expand Down Expand Up @@ -3038,7 +3039,7 @@ close ($IN);

foreach my $geofile (@geofiles) {

#print STDERR "Tags.pm - loading geofile $geofile\n";
print STDERR "Tags.pm - loading geofile $geofile\n";
open (my $IN, "<:encoding(UTF-8)", "$data_root/emb_codes/$geofile");

my @th = split(/\t/, <$IN>);
Expand Down
5 changes: 5 additions & 0 deletions t/tags.t
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ is_deeply (\@tags, [
]
) or diag explain(\@tags);;

foreach my $tag (@tags) {

print STDERR "tag: $tag\tlevel: " . $level{ingredients}{$tag} . "\n";
}

@tags = gen_ingredients_tags_hierarchy_taxonomy("en", "en:concentrated-orange-juice, en:sugar, en:salt, en:orange");

is_deeply (\@tags, [
Expand Down

0 comments on commit 50c1258

Please sign in to comment.