Skip to content

Commit 88f678f

Browse files
committed
Fixed self-assign warning in tests
Some of the tests were creating a variable `res`, however the test system itself relies on it's own `res` variable. This worked out by luck, but could lead to problems if the res variables were different types. Changed the generated variable in the test system to the less common name `test`, which also works out to share the same prefix as other test functions.
1 parent 3ef4847 commit 88f678f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tests/template.fmt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ lfs_size_t size;
5858
lfs_size_t wsize;
5959
lfs_size_t rsize;
6060

61-
uintmax_t res;
61+
uintmax_t test;
6262

6363
#ifndef LFS_READ_SIZE
6464
#define LFS_READ_SIZE 16

tests/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ def generate(test):
1414
match = re.match('(?: *\n)*( *)(.*)=>(.*);', line, re.DOTALL | re.MULTILINE)
1515
if match:
1616
tab, test, expect = match.groups()
17-
lines.append(tab+'res = {test};'.format(test=test.strip()))
18-
lines.append(tab+'test_assert("{name}", res, {expect});'.format(
17+
lines.append(tab+'test = {test};'.format(test=test.strip()))
18+
lines.append(tab+'test_assert("{name}", test, {expect});'.format(
1919
name = re.match('\w*', test.strip()).group(),
2020
expect = expect.strip()))
2121
else:

0 commit comments

Comments
 (0)