scripted-diff: test: Remove brackets after assert
-BEGIN VERIFY SCRIPT- sed -i --regexp-extended -e 's/assert ?\((.+)\)(( )*)?(#.*)?$/assert \1\3\3\4/g' $(git grep -l --extended-regexp 'assert ?\(' test) -END VERIFY SCRIPT-
This commit is contained in:
parent
fab5a1e0f4
commit
fa0e65b772
41 changed files with 273 additions and 273 deletions
test/lint
|
@ -39,7 +39,7 @@ def parse_function_calls(function_name, source_code):
|
|||
>>> len(parse_function_calls("foo", "#define FOO foo();"))
|
||||
0
|
||||
"""
|
||||
assert(type(function_name) is str and type(source_code) is str and function_name)
|
||||
assert type(function_name) is str and type(source_code) is str and function_name
|
||||
lines = [re.sub("// .*", " ", line).strip()
|
||||
for line in source_code.split("\n")
|
||||
if not line.strip().startswith("#")]
|
||||
|
@ -53,7 +53,7 @@ def normalize(s):
|
|||
>>> normalize(" /* nothing */ foo\tfoo /* bar */ foo ")
|
||||
'foo foo foo'
|
||||
"""
|
||||
assert(type(s) is str)
|
||||
assert type(s) is str
|
||||
s = s.replace("\n", " ")
|
||||
s = s.replace("\t", " ")
|
||||
s = re.sub("/\*.*?\*/", " ", s)
|
||||
|
@ -77,7 +77,7 @@ def escape(s):
|
|||
>>> escape(r'foo \\t foo \\n foo \\\\ foo \\ foo \\"bar\\"')
|
||||
'foo [escaped-tab] foo [escaped-newline] foo \\\\\\\\ foo \\\\ foo [escaped-quote]bar[escaped-quote]'
|
||||
"""
|
||||
assert(type(s) is str)
|
||||
assert type(s) is str
|
||||
for raw_value, escaped_value in ESCAPE_MAP.items():
|
||||
s = s.replace(raw_value, escaped_value)
|
||||
return s
|
||||
|
@ -92,7 +92,7 @@ def unescape(s):
|
|||
>>> unescape("foo [escaped-tab] foo [escaped-newline] foo \\\\\\\\ foo \\\\ foo [escaped-quote]bar[escaped-quote]")
|
||||
'foo \\\\t foo \\\\n foo \\\\\\\\ foo \\\\ foo \\\\"bar\\\\"'
|
||||
"""
|
||||
assert(type(s) is str)
|
||||
assert type(s) is str
|
||||
for raw_value, escaped_value in ESCAPE_MAP.items():
|
||||
s = s.replace(escaped_value, raw_value)
|
||||
return s
|
||||
|
@ -151,10 +151,10 @@ def parse_function_call_and_arguments(function_name, function_call):
|
|||
>>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", foo>foo<1,2>(1,2),err)');
|
||||
['strprintf(', '"%s (%d)",', ' foo>foo<1,2>(1,2),', 'err', ')']
|
||||
"""
|
||||
assert(type(function_name) is str and type(function_call) is str and function_name)
|
||||
assert type(function_name) is str and type(function_call) is str and function_name
|
||||
remaining = normalize(escape(function_call))
|
||||
expected_function_call = "{}(".format(function_name)
|
||||
assert(remaining.startswith(expected_function_call))
|
||||
assert remaining.startswith(expected_function_call)
|
||||
parts = [expected_function_call]
|
||||
remaining = remaining[len(expected_function_call):]
|
||||
open_parentheses = 1
|
||||
|
@ -213,7 +213,7 @@ def parse_string_content(argument):
|
|||
>>> parse_string_content('1 2 3')
|
||||
''
|
||||
"""
|
||||
assert(type(argument) is str)
|
||||
assert type(argument) is str
|
||||
string_content = ""
|
||||
in_string = False
|
||||
for char in normalize(escape(argument)):
|
||||
|
@ -240,7 +240,7 @@ def count_format_specifiers(format_string):
|
|||
>>> count_format_specifiers("foo %d bar %i foo %% foo %*d foo")
|
||||
4
|
||||
"""
|
||||
assert(type(format_string) is str)
|
||||
assert type(format_string) is str
|
||||
format_string = format_string.replace('%%', 'X')
|
||||
n = 0
|
||||
in_specifier = False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue