[Perlunit-users] Test-Unit on Win32: OutputDebugString at 'assert' failure time?
Status: Beta
Brought to you by:
mca1001
|
From: Phlip <pl...@sy...> - 2002-11-08 18:29:57
|
Perlies:
I like unit tests. My employers like Win32, VC++, and Perl. So here I am
writing an "acceptance test" rig for our VC++ code, and it calls
Perl embedded in the C++ code.
When an assertion fails, such as this one...
$self -> assert ($result =~ /LW is god/);
...I want the VC++ Output window to contain the file name, line number, and
spit-list of the failure:
c:\projects\testage.pm:14: get a clue, homey...
That way I can tap <F4> and go straight to the offending line in the editor.
No more reading & GotoLine-ing. That's the computer's job.
(Other Perl editors may support these kinds of features before the new
Millenium is old...)
So first I get OutputDebugString from here:
Win32-API-OutputDebugString-0.03.tar.gz
Now I feel like overriding Test::Unit::Debug::debug so it also pushes text
out OutputDebugString:
use Test::Unit::Debug;
{
package Test::Unit::Debug;
*Test::Unit::Debug::debug = sub {
my ($package, $filename, $line) = caller();
print $out "***************************************that's the facts,
Jack!\n";
print $out @_ if $DEBUG{$package};
}
}
That's as far as I can decipher the documentation on global hostile
takeover-style overrides. But even with "strict" and "-w" turned off,
Perl still screams at me: "Subroutine debug redefined..."
Then, if Perl think's it's "redefined" (past-tense), why don't Perl then
call it?
How am I expected to do this?
(BTW I can't "inherit" Test::Unit::Debug and then overload because the other
Test-Unit stuff won't call my derived class.)
--
Phlip
http://www.greencheese.org/NorovostokNovus
-- All sensors report Patti having a very good time --
|