• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7700 for generic doc work for TWiki-6.0.2. Use View topic Item7703 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

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

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:

Expected:'templatename'
 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

Patch:

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});
         $this->assert_str_equals(
             '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($e->isa('TWiki::OopsException'));
         $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});
         $this->assert_str_equals(
             '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

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

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

Checkins

TargetRelease n/a
ReleasedIn

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-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback