Kevin,
Thanks for the reply. I don't necessarily need a global variable, but it was one possible means to an end which I was exploring. Effectively this is the code I'm trying to implement:
Sub testOneEqualTwo( )
assertEqual(1, 2)
End Sub
Sub assertEqual(val1 as integer, val2 as integer)
if val1 <> val2 then
'Do something to "signal" test runner that an assert failed
end if
End Sub
Sub runTests()
eval('testOneEqualTwo')
'Check for "signal" from assertEqual to see if failed
End Sub
One of my thought was to set a global attribute in assertEqual( ) and runTests() could check to see if this was set. Your post pretty much confirms that this will not be possible.
Another thought was to be able to throw my own custom error in assertEqual() which runTests() could check for via the GetLastRunRuntimeError() function. Is it possible to declare and purposely trigger your own run time errors? This doesn't seem to be the case from the docs, but I thought I should ask just in case.
The last approach is to make assertEqual() a member function and then set a attribute in the method like such:
Sub assertEqual(val1 as integer, val2 as integer)
if val1 <> val2 then
'Set attribute to be inspected by runner for assertion failure
m.AssertErrorMessage = "Value1 does not equal Value2"
'Cause run time error so test will stop
i = 1/0
end if
End Sub
It's pretty clunky, but it gets the job done. My quible with it though is it requires testOneEqualTwo() to be a member function as well which is a pain since you have to setup a constructor which attaches all the test*() methods to the roAssociativeArray.