diff options
-rw-r--r-- | t/99-versioning.t | 32 |
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'); +} |