summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-21 17:24:18 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-21 17:24:18 +0000
commit93c544ed08c1001cef0861c0f11d1e7bea0942e2 (patch)
tree4ec3bfa467abd750a427a170c585fb70d60313c3 /t
parent66a914dd4633a06f77509ed027e4d21f4571f0eb (diff)
Adding versioning sanity checks
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1233 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 't')
-rw-r--r--t/99-versioning.t32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/99-versioning.t b/t/99-versioning.t
new file mode 100644
index 00000000..d7ce0126
--- /dev/null
+++ b/t/99-versioning.t
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 9;
+
+use LedgerSMB::Form;
+
+my $form = new Form;
+ok(defined $form, 'form: defined');
+isa_ok($form, 'Form', 'form: correct type');
+ok(defined $form->{version}, 'form: version set');
+ok(defined $form->{dbversion}, 'form: dbversion set');
+$form->{version} =~ s/\s//g;
+$form->{dbversion} =~ s/\s//g;
+
+ok(-e 'VERSION', 'VERSION exists');
+ok(-s 'VERSION', 'VERSION non-empty');
+ok(-r 'VERSION', 'VERSION readable');
+open(my $FH, '<', 'VERSION');
+my $ver = readline $FH;
+close $FH;
+chomp $ver;
+$ver =~ s/\s//g;
+is($form->{version}, $ver, 'Form version matches VERSION');
+
+SKIP: {
+ skip 'Form is trunk', 1 if $form->{version} =~ /trunk$/i;
+ cmp_ok($form->{version}, 'ge', $form->{dbversion},
+ 'form: version >= dbversion');
+}