mirror of https://github.com/swig/swig
Add C "contract" test
Tests that the `%contract` code (viz., each target language's implementation of SWIG_contract_assert) compiles in C as expected. Update the note in the source code since `%contract` is in the official documentation.
This commit is contained in:
parent
c9fbb81e4a
commit
fb0cddfd2b
|
@ -695,6 +695,7 @@ C_TEST_CASES += \
|
||||||
command_line_define \
|
command_line_define \
|
||||||
const_const \
|
const_const \
|
||||||
constant_expr_c \
|
constant_expr_c \
|
||||||
|
contract_c \
|
||||||
default_args_c \
|
default_args_c \
|
||||||
empty_c \
|
empty_c \
|
||||||
enums \
|
enums \
|
||||||
|
|
|
@ -48,6 +48,7 @@ int test_prepost(int x, int y) {
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
/* Class tests */
|
/* Class tests */
|
||||||
|
|
||||||
%contract Foo::test_preassert(int x, int y) {
|
%contract Foo::test_preassert(int x, int y) {
|
||||||
|
@ -235,4 +236,4 @@ class myClass
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
%module contract_c;
|
||||||
|
|
||||||
|
%include <exception.i>
|
||||||
|
|
||||||
|
%include "contract.i"
|
|
@ -172,7 +172,7 @@
|
||||||
#define %novaluewrapper %feature("novaluewrapper")
|
#define %novaluewrapper %feature("novaluewrapper")
|
||||||
#define %clearnovaluewrapper %feature("novaluewrapper","")
|
#define %clearnovaluewrapper %feature("novaluewrapper","")
|
||||||
|
|
||||||
/* Contract support - Experimental and undocumented */
|
/* Contract support - Experimental */
|
||||||
#define %contract %feature("contract")
|
#define %contract %feature("contract")
|
||||||
#define %nocontract %feature("contract","0")
|
#define %nocontract %feature("contract","0")
|
||||||
#define %clearcontract %feature("contract","")
|
#define %clearcontract %feature("contract","")
|
||||||
|
|
Loading…
Reference in New Issue