• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item7524: Unit tests: ExceptionTests don't match the code they test

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension UnitTests Low No Action Required   n/a  

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


ExceptionTests.pm wants to verify the wrong thing. In test_simpleOopsException and test_multiparamOopsException it expects the template to be returned from the exception as they provide, but alas:

 But got:'oopstemplatename'

This is immediately obvious when looking at line 78 of OopsException.pm:

    $template = 'oops' . $template if ( $template !~ /^oops/ );

So the test cases need to be fixed.

-- TWiki:Main/HaraldJoerg - 2014-06-22


Index: ExceptionTests.pm
--- ExceptionTests.pm   (revision 27670)
+++ ExceptionTests.pm   (working copy)
@@ -25,10 +25,10 @@
         $this->assert_str_equals('topicname', $e->{topic});
         $this->assert_str_equals('defname', $e->{def});
         $this->assert_equals(1, $e->{keep});
-        $this->assert_str_equals('templatename', $e->{template});
+        $this->assert_str_equals('oopstemplatename', $e->{template});
             'phlegm', join(',', @{$e->{params}}));
-        $this->assert_str_equals('OopsException(templatename/defname web=>webname topic=>topicname keep=>1 params=>[phlegm])', $e->stringify());
+        $this->assert_str_equals('OopsException(oopstemplatename/defname web=>webname topic=>topicname keep=>1 params=>[phlegm])', $e->stringify());
@@ -46,10 +46,10 @@
         $this->assert_str_equals('webname', $e->{web});
         $this->assert_str_equals('topicname', $e->{topic});
-        $this->assert_str_equals('templatename', $e->{template});
+        $this->assert_str_equals('oopstemplatename', $e->{template});
             'phlegm,<pus>', join(',', @{$e->{params}}));
-        $this->assert_str_equals('OopsException(templatename web=>webname topic=>topicname params=>[phlegm,<pus>])', $e->stringify());
+        $this->assert_str_equals('OopsException(oopstemplatename web=>webname topic=>topicname params=>[phlegm,<pus>])', $e->stringify());
-- TWiki:Main.HaraldJoerg - 2014-06-23

Committed under Item7535, together with the same bug in two other unit tests, so closing this one as duplicate.

-- TWiki:Main.HaraldJoerg - 2014-07-18

Summary Unit tests: ExceptionTests don't match the code they test
ReportedBy TWiki:Main.HaraldJoerg

SVN Range TWiki-6.0.1-trunk, Sun, 15 Jun 2014, build 27651
AppliesTo Extension
Component UnitTests
Priority Low
CurrentState No Action Required


TargetRelease n/a

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r3 - 2014-07-18 - HaraldJoerg
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback