Changeset 14260


Ignore:
Timestamp:
Dec 3, 2019 11:24:53 AM (10 days ago)
Author:
jwedin
Message:

Fixed so TestCase.testException rethrows a caught run time exception. Fixed so an ExceptionTestCase fails when no exception is thrown. #5720

Location:
branches/dev-cw-ii/Compiler/TestFramework/src/jastadd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-cw-ii/Compiler/TestFramework/src/jastadd/ExceptionTestCase.jrag

    r14254 r14260  
    44
    55    /**
    6      * Performs tests on a thrown exception (except for a CompilerException which is not caught).
     6     * Performs tests on a thrown exception.
    77     */
    88    @Override
    9     protected void testException(Exception e) {
     9    protected void testException(RuntimeException e) throws RuntimeException {
    1010        if (e == null) {
    1111            fail("Expected an " + expectedException + " to be thrown!");
  • branches/dev-cw-ii/Compiler/TestFramework/src/jastadd/TestCase.jrag

    r14254 r14260  
    560560                IOException, ModelicaClassNotFoundException {
    561561        UtilInterface uif = UtilInterface.create(options);
     562        RuntimeException testMe = null;
    562563        try {
    563564            performTest(uif);
    564         } catch(Exception e) {
    565             testException(e);
     565        } catch(RuntimeException e) {
     566            testMe = e;
    566567        } finally {
    567568            uif.tearDown();
    568569        }
     570
     571        testException(testMe);
    569572    }
    570573   
     
    698701
    699702    /**
    700      * Performs tests on a thrown exception (except for a CompilerException which is not caught).
    701      */
    702     protected void testException(Exception e) {
     703     * Performs tests on a thrown exception.
     704     */
     705    protected void testException(RuntimeException e) throws RuntimeException {
     706        if (e != null) {
     707            throw e;
     708        }
    703709    }
    704710
Note: See TracChangeset for help on using the changeset viewer.