From f6de1eb1a5a20aa0bf56363e8ffacf74ee76151f Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Thu, 28 Oct 2010 21:40:38 +0000 Subject: [PATCH] New extra tests --- build/lemonldap-ng/Makefile | 5 ++- build/lemonldap-ng/extra-tests/PE_Constants.t | 37 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 build/lemonldap-ng/extra-tests/PE_Constants.t diff --git a/build/lemonldap-ng/Makefile b/build/lemonldap-ng/Makefile index 9e03da517..daf88c642 100644 --- a/build/lemonldap-ng/Makefile +++ b/build/lemonldap-ng/Makefile @@ -171,7 +171,7 @@ manager: manager_conf @$(MAKE) -C ${SRCMANAGERDIR} @touch manager -test: common handler portal manager common_test handler_test portal_test manager_test +test: common_test handler_test portal_test manager_test extra_test common_test: common @$(MAKE) -C ${SRCCOMMONDIR} test @@ -185,6 +185,9 @@ portal_test: portal handler_test common_test manager_test: manager handler_test common_test @$(MAKE) -C ${SRCMANAGERDIR} test FULLPERL="$(PERL) -I../${SRCCOMMONDIR}/blib/lib/ -I../${SRCHANDLERDIR}/blib/lib/" +extra_test: common handler portal manager + PERL_DL_NONLAZY=1 $(PERL) "-MExtUtils::Command::MM" "-e" "test_harness(0, 'lemonldap-ng-common/blib/lib', 'lemonldap-ng-handler/blib/lib', 'lemonldap-ng-manager/blib/lib', 'lemonldap-ng-portal/blib/lib')" extra-tests/*.t + # # INSTALL # diff --git a/build/lemonldap-ng/extra-tests/PE_Constants.t b/build/lemonldap-ng/extra-tests/PE_Constants.t new file mode 100644 index 000000000..f838cccb5 --- /dev/null +++ b/build/lemonldap-ng/extra-tests/PE_Constants.t @@ -0,0 +1,37 @@ +use strict; +use Test::More tests => 6; + +use_ok( 'Lemonldap::NG::Portal::Simple' ); + +ok(open(F, 'lemonldap-ng-portal/blib/lib/Lemonldap/NG/Portal/Simple.pm')); + +my (%h1,%h2,@missingInStatus,@differentValues); + +# Load constants +while(){ + $h1{$1} = $2 if(/^\s*PE_(\w+)\s*=>\s*(-?\d+),$/); + last if(/^sub/); +} +close F; +ok(open(F, 'lemonldap-ng-handler/blib/lib/Lemonldap/NG/Handler/Status.pm')); +while(){ + $h2{$2} = $1 if(/^\s*(-?\d+)\s*=>\s*'PORTAL_(\w+)',$/); +} + +foreach my $k(sort keys %h1) { + if(defined($h2{$k})){ + unless($h1{$k} == $h2{$k}){ + push @differentValues,$k; + } + delete $h2{$k}; + } + else { + push @missingInStatus,$k; + } + delete $h1{$k}; +} + +ok(!@differentValues,'Search different constant values between Status.pm and portal'); +ok(!@missingInStatus,join(', ','Search missing constants in Status.pm',@missingInStatus)); +ok(!(keys %h2), 'Constants set in Status.pm and not in portal'); +