Skip to content

Commit acea5b7

Browse files
committed
Merge branch 'htslib-1620' into develop
2 parents e0e3bd4 + 9288357 commit acea5b7

File tree

8 files changed

+86
-3
lines changed

8 files changed

+86
-3
lines changed

test/test.pl

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,19 @@
288288
run_test(\&test_vcf_norm,$opts,in=>'norm.symbolic',fai=>'norm.symbolic',out=>'norm.symbolic.1.out',args=>'--old-rec-tag ORI');
289289
run_test(\&test_vcf_norm,$opts,in=>'norm.right-align',fai=>'norm.right-align',out=>'norm.right-align.1.out',args=>'--old-rec-tag ORI');
290290
run_test(\&test_vcf_norm,$opts,in=>'norm.right-align',fai=>'norm.right-align',out=>'norm.right-align.2.out',args=>'--old-rec-tag ORI -g {PATH}/norm.right-align.gff');
291+
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.1.out',args=>'',reg=>'-r 1');
292+
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.1.out',args=>'',reg=>'-r 1:1-2');
293+
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.1.out',args=>'',reg=>'-r 1:1,1:2');
294+
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.2.out',args=>'',reg=>'-r 1:1-1');
295+
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.3.out',args=>'',reg=>'-r {1:1}');
296+
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.3.out',args=>'',reg=>'-r {1:1}:1-2');
297+
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.3.out',args=>'',reg=>'-r {1:1}:1,{1:1}:2');
298+
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.4.out',args=>'',reg=>'-r {1:1}:1-1');
299+
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.5.out',args=>'',reg=>'-r {1:1-1}');
300+
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.5.out',args=>'',reg=>'-r {1:1-1}:1-2');
301+
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.5.out',args=>'',reg=>'-r {1:1-1}:1,{1:1-1}:2');
302+
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.6.out',args=>'',reg=>'-r {1:1-1}:1-1');
303+
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',args=>'',reg=>'-r {1:1-1}-2',expected_failure=>1);
291304
run_test(\&test_vcf_view,$opts,in=>'view',out=>'view.1.out',args=>'-aUc1 -C1 -s NA00002 -v snps',reg=>'');
292305
run_test(\&test_vcf_view,$opts,in=>'view',out=>'view.2.out',args=>'-f PASS -Xks NA00003',reg=>'-r20,Y');
293306
run_test(\&test_vcf_view,$opts,in=>'view',out=>'view.3.out',args=>'-xs NA00003',reg=>'');
@@ -1078,7 +1091,13 @@ sub test_cmd
10781091
10791092
my ($ret,$out,$err) = _cmd3("$args{cmd}");
10801093
if ( length($err) ) { $err =~ s/\n/\n\t\t/gs; $err = "\n\n\t\t$err\n"; }
1081-
if ( $ret ) { failed($opts,$test,"Non-zero status $ret$err"); return; }
1094+
if ( $ret && !$args{expected_failure} ) { failed($opts,$test,"Non-zero status $ret$err"); return; }
1095+
if ( $args{expected_failure} )
1096+
{
1097+
if ( !$ret ) { failed($opts,$test,"Expected failure but the test returned $ret$err"); }
1098+
else { passed($opts,$test,"ok, expected non-zero status"); }
1099+
return;
1100+
}
10821101
if ( $$opts{redo_outputs} && -e "$$opts{path}/$args{out}" )
10831102
{
10841103
rename("$$opts{path}/$args{out}","$$opts{path}/$args{out}.old");
@@ -1150,9 +1169,10 @@ sub failed
11501169
}
11511170
sub passed
11521171
{
1153-
my ($opts,$test) = @_;
1172+
my ($opts,$test,$reason) = @_;
11541173
$$opts{nok}++;
1155-
print ".. ok\n\n";
1174+
if ( !defined $reason ) { $reason = 'ok'; }
1175+
print ".. $reason\n\n";
11561176
}
11571177
sub is_file_newer
11581178
{

test/weird-chr-names.1.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
##fileformat=VCFv4.3
2+
##FILTER=<ID=PASS,Description="All filters passed">
3+
##reference=ref.fa
4+
##contig=<ID=1>
5+
##contig=<ID=1:1>
6+
##contig=<ID=1:1-1>
7+
#CHROM POS ID REF ALT QUAL FILTER INFO
8+
1 1 . C T . . .
9+
1 2 . C T . . .

test/weird-chr-names.2.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
##fileformat=VCFv4.3
2+
##FILTER=<ID=PASS,Description="All filters passed">
3+
##reference=ref.fa
4+
##contig=<ID=1>
5+
##contig=<ID=1:1>
6+
##contig=<ID=1:1-1>
7+
#CHROM POS ID REF ALT QUAL FILTER INFO
8+
1 1 . C T . . .

test/weird-chr-names.3.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
##fileformat=VCFv4.3
2+
##FILTER=<ID=PASS,Description="All filters passed">
3+
##reference=ref.fa
4+
##contig=<ID=1>
5+
##contig=<ID=1:1>
6+
##contig=<ID=1:1-1>
7+
#CHROM POS ID REF ALT QUAL FILTER INFO
8+
1:1 1 . C T . . .
9+
1:1 2 . C T . . .

test/weird-chr-names.4.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
##fileformat=VCFv4.3
2+
##FILTER=<ID=PASS,Description="All filters passed">
3+
##reference=ref.fa
4+
##contig=<ID=1>
5+
##contig=<ID=1:1>
6+
##contig=<ID=1:1-1>
7+
#CHROM POS ID REF ALT QUAL FILTER INFO
8+
1:1 1 . C T . . .

test/weird-chr-names.5.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
##fileformat=VCFv4.3
2+
##FILTER=<ID=PASS,Description="All filters passed">
3+
##reference=ref.fa
4+
##contig=<ID=1>
5+
##contig=<ID=1:1>
6+
##contig=<ID=1:1-1>
7+
#CHROM POS ID REF ALT QUAL FILTER INFO
8+
1:1-1 1 . C T . . .
9+
1:1-1 2 . C T . . .

test/weird-chr-names.6.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
##fileformat=VCFv4.3
2+
##FILTER=<ID=PASS,Description="All filters passed">
3+
##reference=ref.fa
4+
##contig=<ID=1>
5+
##contig=<ID=1:1>
6+
##contig=<ID=1:1-1>
7+
#CHROM POS ID REF ALT QUAL FILTER INFO
8+
1:1-1 1 . C T . . .

test/weird-chr-names.vcf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
##fileformat=VCFv4.3
2+
##reference=ref.fa
3+
##contig=<ID=1>
4+
##contig=<ID=1:1>
5+
##contig=<ID=1:1-1>
6+
#CHROM POS ID REF ALT QUAL FILTER INFO
7+
1 1 . C T . . .
8+
1 2 . C T . . .
9+
1:1 1 . C T . . .
10+
1:1 2 . C T . . .
11+
1:1-1 1 . C T . . .
12+
1:1-1 2 . C T . . .

0 commit comments

Comments
 (0)