File Coverage

ext/XS-APItest/exception.c
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine n/a
total 11 11 100.0


line stmt bran cond sub time code
1           #include "EXTERN.h"
2           #include "perl.h"
3            
4           #define NO_XSLOCKS
5           #include "XSUB.h"
6            
7           static void throws_exception(int throw_e)
8           {
9 4         if (throw_e)
10 2         croak("boo\n");
11           }
12            
13           /* Don't give this the same name as execution() in ext/Devel/PPPort/module3.c
14           as otherwise building entirely statically will cause a test to fail, as
15           PPPort's execption() gets used in place of this one. */
16          
17 4         int apitest_exception(int throw_e)
18           {
19           dTHR;
20           dXCPT;
21 4         SV *caught = get_sv("XS::APItest::exception_caught", 0);
22            
23 4         XCPT_TRY_START {
24           throws_exception(throw_e);
25 4         } XCPT_TRY_END
26            
27 4         XCPT_CATCH
28           {
29 2         sv_setiv(caught, 1);
30 2         XCPT_RETHROW;
31           }
32            
33 2         sv_setiv(caught, 0);
34            
35 2         return 42;
36           }
37