Support (void) as an argument list of a test function
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
096f0ca7e5
commit
47e2e8817d
2 changed files with 45 additions and 11 deletions
|
@ -513,9 +513,9 @@ class ParseFuncSignature(TestCase):
|
|||
line = 'void entropy_threshold( char * a, data_t * h, char result )'
|
||||
self.assertRaises(ValueError, parse_function_arguments, line)
|
||||
|
||||
def test_no_params(self):
|
||||
def test_empty_params(self):
|
||||
"""
|
||||
Test no parameters.
|
||||
Test no parameters (nothing between parentheses).
|
||||
:return:
|
||||
"""
|
||||
line = 'void entropy_threshold()'
|
||||
|
@ -524,6 +524,39 @@ class ParseFuncSignature(TestCase):
|
|||
self.assertEqual(local, '')
|
||||
self.assertEqual(arg_dispatch, [])
|
||||
|
||||
def test_blank_params(self):
|
||||
"""
|
||||
Test no parameters (space between parentheses).
|
||||
:return:
|
||||
"""
|
||||
line = 'void entropy_threshold( )'
|
||||
args, local, arg_dispatch = parse_function_arguments(line)
|
||||
self.assertEqual(args, [])
|
||||
self.assertEqual(local, '')
|
||||
self.assertEqual(arg_dispatch, [])
|
||||
|
||||
def test_void_params(self):
|
||||
"""
|
||||
Test no parameters (void keyword).
|
||||
:return:
|
||||
"""
|
||||
line = 'void entropy_threshold(void)'
|
||||
args, local, arg_dispatch = parse_function_arguments(line)
|
||||
self.assertEqual(args, [])
|
||||
self.assertEqual(local, '')
|
||||
self.assertEqual(arg_dispatch, [])
|
||||
|
||||
def test_void_space_params(self):
|
||||
"""
|
||||
Test no parameters (void with spaces).
|
||||
:return:
|
||||
"""
|
||||
line = 'void entropy_threshold( void )'
|
||||
args, local, arg_dispatch = parse_function_arguments(line)
|
||||
self.assertEqual(args, [])
|
||||
self.assertEqual(local, '')
|
||||
self.assertEqual(arg_dispatch, [])
|
||||
|
||||
|
||||
class ParseFunctionCode(TestCase):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue