[b4b313]: / matlab_xunit_3.1 / matlab_xunit / tests / testAssertExceptionThrown.m

Download this file

24 lines (15 with data), 693 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
function test_suite = testAssertExceptionThrown
%testAssertExceptionThrown Unit tests for assertExceptionThrown
% Steven L. Eddins
% Copyright 2008 The MathWorks, Inc.
initTestSuite;
function test_happyCase
assertExceptionThrown(...
@() error('MyProd:MyFun:MyId', 'my message'), 'MyProd:MyFun:MyId');
function test_wrongException
assertExceptionThrown(@() assertExceptionThrown(...
@() error('MyProd:MyFun:MyId', 'my message'), ...
'MyProd:MyFun:DifferentId'), 'assertExceptionThrown:wrongException');
function test_noException
assertExceptionThrown(@() assertExceptionThrown(@() sin(pi), 'foobar'), ...
'assertExceptionThrown:noException');