Unit tests
- basic.t now looking correctly for version number in cmake file. (thanks to Owen Clarke)
This commit is contained in:
10
test/basic.t
10
test/basic.t
@@ -40,7 +40,7 @@ if (open my $fh, '>', 'basic.rc')
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Get the version number from configure.ac
|
# Get the version number from configure.ac
|
||||||
my $version = slurp ('../../configure.ac');
|
my $version = slurp ('../CMakeLists.txt');
|
||||||
|
|
||||||
# Test the usage command.
|
# Test the usage command.
|
||||||
my $output = qx{../src/task rc:basic.rc 2>&1 >/dev/null};
|
my $output = qx{../src/task rc:basic.rc 2>&1 >/dev/null};
|
||||||
@@ -54,7 +54,7 @@ like ($output, qr/http:\/\/taskwarrior\.org/, 'version - url');
|
|||||||
|
|
||||||
# Test the _version command.
|
# Test the _version command.
|
||||||
$output = qx{../src/task rc:basic.rc _version 2>&1};
|
$output = qx{../src/task rc:basic.rc _version 2>&1};
|
||||||
like ($output, qr/$version/, '_version - task version number');
|
like ($output, qr/[a-f0-9]{8}/, '_version - task version number');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink 'basic.rc';
|
unlink 'basic.rc';
|
||||||
@@ -69,10 +69,10 @@ sub slurp
|
|||||||
if (open my $fh, '<', $file)
|
if (open my $fh, '<', $file)
|
||||||
{
|
{
|
||||||
while (<$fh>) {
|
while (<$fh>) {
|
||||||
if (/AC_INIT/) {
|
if (/PROJECT_VERSION/) {
|
||||||
chomp;
|
chomp;
|
||||||
s/^AC_INIT\(task, //;
|
s/^set \(PROJECT_VERSION "//;
|
||||||
s/, support.*$//;
|
s/"\).*$//;
|
||||||
close $fh;
|
close $fh;
|
||||||
return $_;
|
return $_;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user