Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add version test

  • Loading branch information...
commit b2c16f35972c6eef1f6f1e785a34635cc587c169 1 parent 0d61841
Grant McLean authored
Showing with 46 additions and 0 deletions.
  1. +2 −0  bin/bcvi
  2. +44 −0 t/01_version.t
2  bin/bcvi
View
@@ -26,6 +26,8 @@ require 5.008;
package App::BCVI;
+our $VERSION = '3.06';
+
use File::Spec;
use File::Path;
use Getopt::Long qw();
44 t/01_version.t
View
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+BEGIN {
+ unless ($ENV{RELEASE_TESTING}) {
+ require Test::More;
+ Test::More::plan(skip_all => 'this test is for release candidate testing');
+ }
+}
+
+use Test::More;
+
+my $release_version = get_release_version('dist.ini');
+my $script_version = get_script_version('bin/bcvi');
+
+is($script_version, $release_version, "version in script");
+
+done_testing();
+exit;
+
+
+sub get_release_version {
+ my($path) = @_;
+
+ open my $fh, '<', $path or die "open($path): $!";
+ while(<$fh>) {
+ if(/^version\s+=\s+(\S+)/) {
+ return $1;
+ }
+ }
+}
+
+sub get_script_version {
+ my($path) = @_;
+
+ open my $fh, '<', $path or die "open($path): $!";
+ while(<$fh>) {
+ if(/^our \$VERSION\s+=\s+'(\S+)'/) {
+ return $1;
+ }
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.