summaryrefslogtreecommitdiff
path: root/t/99-versioning.t
blob: d7ce012651a5ffab0ffd0a74ae191b916a098deb (plain)
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Test::More tests => 9;
  5. use LedgerSMB::Form;
  6. my $form = new Form;
  7. ok(defined $form, 'form: defined');
  8. isa_ok($form, 'Form', 'form: correct type');
  9. ok(defined $form->{version}, 'form: version set');
  10. ok(defined $form->{dbversion}, 'form: dbversion set');
  11. $form->{version} =~ s/\s//g;
  12. $form->{dbversion} =~ s/\s//g;
  13. ok(-e 'VERSION', 'VERSION exists');
  14. ok(-s 'VERSION', 'VERSION non-empty');
  15. ok(-r 'VERSION', 'VERSION readable');
  16. open(my $FH, '<', 'VERSION');
  17. my $ver = readline $FH;
  18. close $FH;
  19. chomp $ver;
  20. $ver =~ s/\s//g;
  21. is($form->{version}, $ver, 'Form version matches VERSION');
  22. SKIP: {
  23. skip 'Form is trunk', 1 if $form->{version} =~ /trunk$/i;
  24. cmp_ok($form->{version}, 'ge', $form->{dbversion},
  25. 'form: version >= dbversion');
  26. }