X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/f71db23824a25300618dd0625085ade8d2b3a7a8..28ab82aab013978b7ed91bda816de3d41385f260:/tests/data/string_quotes.py?ds=sidebyside diff --git a/tests/data/string_quotes.py b/tests/data/string_quotes.py index 1ac6b06..3384241 100644 --- a/tests/data/string_quotes.py +++ b/tests/data/string_quotes.py @@ -1,3 +1,4 @@ +'''''' '\'' '"' "'" @@ -42,9 +43,22 @@ re.compile(r'[\\"]') "unnecessary \'\'escaping" '\\""' "\\''" +'Lots of \\\\\\\\\'quotes\'' +f'{y * " "} \'{z}\'' +f'{{y * " "}} \'{z}\'' +f'\'{z}\' {y * " "}' +f'{y * x} \'{z}\'' +'\'{z}\' {y * " "}' +'{y * x} \'{z}\'' + +# We must bail out if changing the quotes would introduce backslashes in f-string +# expressions. xref: https://github.com/psf/black/issues/2348 +f"\"{b}\"{' ' * (long-len(b)+1)}: \"{sts}\",\n" +f"\"{a}\"{'hello' * b}\"{c}\"" # output +"""""" "'" '"' "'" @@ -70,12 +84,7 @@ r"Date d\'expiration:(.*)" r'Tricky "quote' r"Not-so-tricky \"quote" rf"{yay}" -"\n\ -The \"quick\"\n\ -brown fox\n\ -jumps over\n\ -the 'lazy' dog.\n\ -" +"\nThe \"quick\"\nbrown fox\njumps over\nthe 'lazy' dog.\n" re.compile(r'[\\"]') "x = ''; y = \"\"" "x = '''; y = \"\"" @@ -89,3 +98,15 @@ re.compile(r'[\\"]') "unnecessary ''escaping" '\\""' "\\''" +"Lots of \\\\\\\\'quotes'" +f'{y * " "} \'{z}\'' +f"{{y * \" \"}} '{z}'" +f'\'{z}\' {y * " "}' +f"{y * x} '{z}'" +"'{z}' {y * \" \"}" +"{y * x} '{z}'" + +# We must bail out if changing the quotes would introduce backslashes in f-string +# expressions. xref: https://github.com/psf/black/issues/2348 +f"\"{b}\"{' ' * (long-len(b)+1)}: \"{sts}\",\n" +f"\"{a}\"{'hello' * b}\"{c}\""