This is not going to work. You are using the rexx command to invoke the
program, which spins off a new process to run the program. Syntax errors
cannot be trapped across that boundary. If you invoke the program using the
CALL instruction, this will probably work. However, then you are unable to
use ADDRESS WITH to trap the syntax errors. You could probably trap ERROR
separately and check the syntax errors, but that might be a bit volatile
for building test cases.

Rick

On Fri, Oct 19, 2018 at 4:08 PM P.O. Jonsson <[email protected]> wrote:

> Here is the test case in question:
>
> ::method "test_011_interface.rex"
>   trace o
>
>   say
>   say '...running test method:' .context~name~lower
>
>   Line.1 = 'a Rectangle is a shape'
>   Line.2 = 'r~area: 10'
>   Line.3 = ''
>   Line.4 = 'a Circle is a shape'
>   Line.5 = 'c~area: 12.566370614359172954'
>   Line.6 = ''
>   Line.7 = 'a SHAPE is a shape'
>   Line.0 = 7
>
>   self~expectSyntax(93.965)
>
>   SELECT CASE .ooRexxUnit.OSName
>     WHEN 'WINDOWS' THEN ADDRESS command 'rexx' .local~samplesdir ||
> 'interface.rex' WITH OUTPUT STEM myStem.
>     OTHERWISE           ADDRESS ''      'rexx' .local~samplesdir ||
> 'interface.rex' WITH OUTPUT STEM myStem.
>   END /* Select */
>
>   DO i= 1 TO Line.0
>     self~assertEquals(Line.i,myStem.i)
>   END i
>
> I have tried to change the order of the tests but cannot make it work.
> Once the runtime error happens I am out.
>
> Attached is the complete samples.framework I have done so far. It assumes
> the samples in subdirectory /ooRexx from where the test runs, this can and
> will be changed later I have only set it up like this to be able to do the
> tests during my holidays. Also semantic changes ( I prefer to write IBM
> REXX style)) can easily be made using search&replace later.
>
>
> Von meinen Macbook gesendet
>
> Hälsningar/Regards/Grüsse,
> P.O. Jonsson
> [email protected]
>
>
>
> Am 19.10.2018 um 21:51 schrieb Rick McGuire <[email protected]>:
>
> Then show your failing test case method so we can see what you are doing
> wrong. Just saying "it doesn't work" gives us no information about what
> might be going wrong. For example, how are you invoking the program?
>
> Rick
>
> On Fri, Oct 19, 2018 at 3:42 PM P.O. Jonsson <[email protected]> wrote:
>
>> I was unclear: I am writing test cases for ALL sample programs, the
>> intention is that they will go into the unit test framework later when I
>> have done them all. I promised Erich to have a go at it.
>>
>> I have done 10 tests successfully so far, but for this one I could not
>> get around the error. I have successfully detected syntax errors in running
>> other sample programs so it is only this one I need help with (at the
>> moment).
>>
>> Von meinen Macbook gesendet
>>
>> Hälsningar/Regards/Grüsse,
>> P.O. Jonsson
>> [email protected]
>>
>>
>>
>> Am 19.10.2018 um 21:37 schrieb Rick McGuire <[email protected]>:
>>
>> This program is not using the unit test framework so expectSyntax is not
>> going to work.
>>
>> Rick
>>
>> On Fri, Oct 19, 2018 at 3:33 PM P.O. Jonsson <[email protected]> wrote:
>>
>>> Dear developers,
>>>
>>> In one of the sample files interface.rex there is an intended error
>>> produced to show the point. The output is the following:
>>>
>>>     70 *-* say g~name
>>> REX0093E: Error 93 running /Users/po/ooRexxSamples/oorexx/interface.REX
>>> line 70:  Incorrect call to method.
>>> REX0665E: Error 93.965:  Method NAME is ABSTRACT and cannot be directly
>>> invoked.
>>>
>>> I am trying to catch this error by using
>>>
>>> self~expectSyntax(93.965) (or self~expectSyntax(93) and many variations)
>>> but cannot catch it. The source code in question is
>>>
>>> -- a mixin is still a class and can be instantiated.  The abstract
>>> methods
>>> -- will give an error if invoked
>>> g=.shape~new
>>> if g~isa(.shape) then say "a" g~class~id "is a shape"
>>> -- invoking abstract method results in a runtime error.
>>> say g~name
>>> say "g~area:" g~area
>>>
>>> How do I catch a runtime error in a testcase? can it be done?
>>>
>>> I have enclosed the sample program
>>>
>>>
>>> Von meinen Macbook gesendet
>>>
>>> Hälsningar/Regards/Grüsse,
>>> P.O. Jonsson
>>> [email protected]
>>>
>>>
>>>
>>> _______________________________________________
>>> Oorexx-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>>>
>> _______________________________________________
>> Oorexx-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>>
>>
>> _______________________________________________
>> Oorexx-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>>
> _______________________________________________
> Oorexx-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
>
> _______________________________________________
> Oorexx-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to