Item10498: Fn_MAKETEXT kills Unit Tests suite with redefined subroutine error

pencil
Priority: Normal
Current State: Closed
Released In: 1.1.3
Target Release: patch
Applies To: Engine
Component: MAKETEXT, UnitTestContrib
Branches:
Reported By: GeorgeClark
Waiting For:
Last Change By: OlivierRaginel
Tests fail with:
Subroutine available_languages redefined at.../trunk/core/lib/Foswiki/I18N.pm line 32

The problem is that Fn_MAKETEXT in the BEGIN block issues
delete $INC{'Foswiki/I18N.pm'};

but this doesn't clear the symbol table. The following code works much better but calls out additional dependencies for the unit test.
Class::Unload->unload('Foswiki::I18N');

It requires
  • Class::Unload
  • Class::Inspector

-- GeorgeClark - 17 Mar 2011

The solution has been committed as a comment with a #SMELL

-- GeorgeClark - 17 Mar 2011

Committed a real fix by reading the code from Class::Unload and applying the logic to our problematic.

-- OlivierRaginel - 21 Mar 2011

 

ItemTemplate edit

Summary Fn_MAKETEXT kills Unit Tests suite with redefined subroutine error
ReportedBy GeorgeClark
Codebase 1.1.3 beta1, trunk
SVN Range
AppliesTo Engine
Component MAKETEXT, UnitTestContrib
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:4eee16b56884 distro:852467bf536c distro:10807656151d distro:5609f622f4e7 distro:5c346ca74dde
TargetRelease patch
ReleasedIn 1.1.3
Topic revision: r7 - 21 Mar 2011, OlivierRaginel
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy