From d5d46fd5894b7339532c4f7576c8aa55ce44d285 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Thu, 5 Oct 2006 03:20:59 +0000 Subject: Bug 351175: The WebService interface should include the error text along with the error name Patch By Max Kanat-Alexander r=Wurblzap, a=myk --- t/012throwables.t | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 't/012throwables.t') diff --git a/t/012throwables.t b/t/012throwables.t index 8bc749686..b846ab907 100644 --- a/t/012throwables.t +++ b/t/012throwables.t @@ -19,6 +19,7 @@ # Rights Reserved. # # Contributor(s): Dennis Melentyev +# Max Kanat-Alexander @@ -30,6 +31,8 @@ use strict; use lib 't'; +use Bugzilla::WebService::Constants; + use File::Spec; use Support::Files; use Support::Templates; @@ -63,8 +66,8 @@ foreach my $include_path (@include_paths) { } } -# Count the tests -my $tests = (scalar keys %test_modules) + (scalar keys %test_templates); +# Count the tests. The +1 is for checking the WS_ERROR_CODE errors. +my $tests = (scalar keys %test_modules) + (scalar keys %test_templates) + 1; exit 0 if !$tests; # Set requested tests counter. @@ -162,11 +165,27 @@ foreach my $errtype (keys %Errors) { } } +# And make sure that everything defined in WS_ERROR_CODE +# is actually a valid error. +foreach my $err_name (keys %{WS_ERROR_CODE()}) { + if (!defined $Errors{'code'}{$err_name} + && !defined $Errors{'user'}{$err_name}) + { + Register(\%test_modules, 'WS_ERROR_CODE', + "Error tag '$err_name' is used in WS_ERROR_CODE in" + . " Bugzilla/WebService/Constants.pm" + . " but not defined in any template, and not used in any code."); + } +} + # Now report modules results foreach my $file (sort keys %test_modules) { Report($file, @{$test_modules{$file}}); } +# And report WS_ERROR_CODE results +Report('WS_ERROR_CODE', @{$test_modules{'WS_ERROR_CODE'}}); + # Now report templates results foreach my $file (sort keys %test_templates) { Report($file, @{$test_templates{$file}}); -- cgit v1.2.3-24-g4f1b