File: unset.t

package info (click to toggle)
libdata-stag-perl 0.14-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 1,484 kB
  • ctags: 753
  • sloc: perl: 6,394; lisp: 141; xml: 116; ansic: 55; makefile: 17; sh: 2
file content (32 lines) | stat: -rw-r--r-- 708 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use lib 't';

BEGIN {
    # to handle systems with no installed Test module
    # we include the t dir (where a copy of Test.pm is located)
    # as a fallback
    eval { require Test; };
    use Test;    
    plan tests => 4;
}
use Data::Stag;
use FileHandle;

my $fn = "t/data/homol.itext";
my $stag = Data::Stag->parse($fn);

my $s = $stag->sxpr;
#print $stag->sxpr;

$stag->unset("species/tax_id");
#print $stag->sxpr;

my @species = $stag->get('species_set/species');
ok(@species == 3);
# all species/tax_id should be removed
ok(!grep {$_->get_tax_id} @species);


my @genes = $stag->get('gene_set/gene');
ok(@genes == 2);
# all species/tax_id should be removed
ok((grep {$_->get_tax_id} @genes) == 2);