From 93c544ed08c1001cef0861c0f11d1e7bea0942e2 Mon Sep 17 00:00:00 2001 From: tetragon Date: Mon, 21 May 2007 17:24:18 +0000 Subject: 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 --- t/99-versioning.t | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 t/99-versioning.t 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'); +} -- cgit v1.2.3