maint: remove Travis stuff which has been replaced with Github actions (#325)
[bioperl-live.git] / t / SeqFeature / Clone.t
blob1bcc0a05de81869f2f981dec628e77de11b15bc5
1 # -*-Perl-*- Test Harness script for Bioperl
3 use strict;
5 BEGIN {
6     use Bio::Root::Test;
7     use Bio::SeqFeature::Generic;
8     use Bio::Location::Split;
10     test_begin(-tests => 17);
13 my $DEBUG = test_debug();
15 my $orig = Bio::SeqFeature::Generic->new(
16                                        -start => 40,
17                                        -end => 80,
18                                        -strand => 1,
19                                        -primary => 'exon',
20                                        -source  => 'internal',
21                                        -tag => {
22                                            silly => 20,
23                                            new => 1
24                                            }
25                                        );
27 # ----------
28 # Verify simple attributes work and are independent of each other
29 ok(my $clone = $orig->clone(),                'clone()');
30 ok($clone->start(140),                        'start() clone set');
31 is($clone->start(),     140,                  'start() clone get');
32 is($orig->start(),      40,                   'start() original unchanged');
34 # ----------
35 # Verify that arguments passed into clone() are applied to the cloned object
36 # and that the attributes are still independent.
37 ok($clone = $orig->clone(-start => 150, -end => 157),   'clone() with arguments');
38 is($orig->start(),       40,                  'start() orig get');
39 is($orig->end(),         80,                  'end() orig get');
40 is($clone->start(),     150,                  'start() clone get');
41 is($clone->end(),       157,                  'end() clone get');
42 ok($clone->start(140),                        'start() clone set');
43 is($clone->start(),     140,                  'start() clone get');
44 is($orig->start(),       40,                  'start() original unchanged');
46 # ----------
47 # Verify that object attributes can be cloned, and are independent after cloning
48 my $splitlocation = Bio::Location::Split->new();
49 $splitlocation->add_sub_Location(Bio::Location::Simple->new(
50    -start=>1, -end=>30, -strand=>1
51 ));
52 $splitlocation->add_sub_Location(Bio::Location::Simple->new(
53    -start=>50, -end=>61, -strand=>1
54 ));
55 ok($orig->location($splitlocation),                      'location() Bio::Location::Split');
56 ok($clone = $orig->clone(),                           'clone()');
57 ok(($clone->location->sub_Location())[1]->start(51),     'start() clone set');
58 is(($clone->location->sub_Location())[1]->start,     51, 'start() clone get');
59 is(($orig->location->sub_Location())[1]->start,      50, 'start() original unchanged');