Changeset 14251


Ignore:
Timestamp:
Dec 2, 2019 4:55:32 PM (11 days ago)
Author:
jwedin
Message:

Added a new type of test case that checks if an exception is thrown when compiling a model. This can be used to verify that an exception of the right type is thrown when compiling a model where it is expected that an exception will be thrown. #5720

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

Legend:

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

    r13384 r14251  
    628628       
    629629       
     630        Exception testMe = null;
    630631        // Transform canonical and check for errors again
    631632        try {
     
    635636        } catch (CompilerException e) {
    636637            problems = e.getProblems();
    637         }
     638        } catch (Exception e) {
     639            testMe = e;
     640        }
     641
     642        if (testException(testMe)) {
     643            return;
     644        }
     645
    638646        if (testTransformedProblems(problems)) return;
    639647       
     
    693701     *  Test types.  *
    694702     * ============= */
     703
     704    /**
     705     * Performs tests on a thrown exception (except for a CompilerException which is not caught).
     706     *
     707     * @return  {@code true} if the test case should stop after this method.
     708     */
     709    protected boolean testException(Exception e) {
     710        return false;
     711    }
    695712
    696713    /**
Note: See TracChangeset for help on using the changeset viewer.