mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
annotate_ifdef_directives: test edge-case of 80-char line
An 80-character line (79 characters if you don't count the newline) should not be truncated, and should not have a "..." insterted.
This commit is contained in:
@@ -156,6 +156,22 @@ def commented_line(fmt, argument, maxwidth=LINE_WIDTH):
|
||||
'#endif /* long long long long long long '
|
||||
>>> long_line[40:]
|
||||
'long long long long long long lon... */\n'
|
||||
|
||||
If a line works out to being 80 characters naturally, it isn't truncated,
|
||||
and no ellipsis is added.
|
||||
|
||||
>>> medium_argument = "a"*66
|
||||
>>> medium_line = commented_line("#endif /* %s */\n", medium_argument)
|
||||
>>> len(medium_line)
|
||||
80
|
||||
>>> "..." in medium_line
|
||||
False
|
||||
>>> medium_line[:40]
|
||||
'#endif /* aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
>>> medium_line[40:]
|
||||
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa */\n'
|
||||
|
||||
|
||||
"""
|
||||
assert fmt.endswith("\n")
|
||||
result = fmt % argument
|
||||
|
||||
Reference in New Issue
Block a user