Commit a35fad6a authored by Sergio Costas's avatar Sergio Costas

Added another test

parent fb7bcc2c
......@@ -417,8 +417,10 @@ class crusty(object):
self._add_error(self.MSG_CRITICAL,"Parameter '{:s}' defined as __crust_t__ type at line {:d}, but it is not a pointer",node.name,node.line)
else:
if is_retval:
#added
self._add_error(self.MSG_CRITICAL,"Return value for function '{:s}', defined at line {:d}, is defined as __crust_t__ type, but it is not a pointer",node.name,node.line)
else:
#added
self._add_error(self.MSG_CRITICAL,"Variable '{:s}' is defined as __crust_t__ type at line {:d}, but it is not a pointer",node.name,node.line)
retval += crusty.PROPERTY_CRUST_VARIABLE
if (node.t_crusty_borrow or node.t_crusty_recycle):
......
......@@ -79,8 +79,11 @@ class Test(unittest.TestCase):
def testCrustNamedParameterNotPointer(self):
self._generic_test("unitest/test12.c",False,crusty.crusty.MSG_CRITICAL,"Parameter '{:s}' defined as __crust_t__ type at line {:d}, but it is not a pointer","parameter",1)
def testCrustRetvalNotPointer(self):
def testCrustVariableNotPointer(self):
self._generic_test("unitest/test13.c",False,crusty.crusty.MSG_CRITICAL,"Variable '{:s}' is defined as __crust_t__ type at line {:d}, but it is not a pointer","retval",5)
def testCrustRetvalNotPointer(self):
self._generic_test("unitest/test14.c",False,crusty.crusty.MSG_CRITICAL,"Return value for function '{:s}', defined at line {:d}, is defined as __crust_t__ type, but it is not a pointer","function",1)
if __name__ == '__main__':
unittest.main()
......@@ -2,5 +2,5 @@ typedef __crust_t__ unsigned char crust_t;
int function() {
crust_t retval = function();
crust_t retval;
}
__crust_t__ int function() {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment