|
|
|
@ -24,7 +24,7 @@ class TestFormatter(unittest.TestCase):
|
|
|
|
|
self.assertEqual(["foo", "bar {", "johan {", "tee", "ka", "}"],
|
|
|
|
|
join_opening_bracket(("foo", "bar {", "johan", "{", "tee", "ka", "}")))
|
|
|
|
|
|
|
|
|
|
def test_clear_lines(self):
|
|
|
|
|
def test_clean_lines(self):
|
|
|
|
|
self.assertEqual(["ala", "ma", "{", "kota", "}", "to;", "", "ook"],
|
|
|
|
|
clean_lines(("ala", "ma {", "kota", "}", "to;", "", "ook")))
|
|
|
|
|
|
|
|
|
@ -37,6 +37,8 @@ class TestFormatter(unittest.TestCase):
|
|
|
|
|
self.assertEqual(["{", "ala", "# ma {{", "kota", "}", "to", "}", "# }"],
|
|
|
|
|
clean_lines(("{", "ala ", "# ma {{", " kota ", "}", " to} ", "# }")))
|
|
|
|
|
|
|
|
|
|
self.assertEqual(["location ~ /\.ht", "{"], clean_lines(["location ~ /\.ht {", ]))
|
|
|
|
|
|
|
|
|
|
def test_perform_indentation(self):
|
|
|
|
|
self.assertEqual([
|
|
|
|
|
"foo bar {",
|
|
|
|
@ -161,6 +163,21 @@ class TestFormatter(unittest.TestCase):
|
|
|
|
|
'}\n' +
|
|
|
|
|
'# in my line\n')
|
|
|
|
|
|
|
|
|
|
def test_backslash(self):
|
|
|
|
|
self._check_formatting('location ~ /\.ht {\n' +
|
|
|
|
|
'deny all;\n' +
|
|
|
|
|
'}',
|
|
|
|
|
'location ~ /\.ht {\n' +
|
|
|
|
|
' deny all;\n' +
|
|
|
|
|
'}\n')
|
|
|
|
|
|
|
|
|
|
self._check_formatting(' tag { wt ~ /\.ht \t "my ${var} and ~ /\.ht \tother ${ variable_name } "; }\n' +
|
|
|
|
|
'# in my line\n',
|
|
|
|
|
'tag {\n' +
|
|
|
|
|
' wt ~ /\.ht "my ${var} and ~ /\.ht \tother ${variable_name} ";\n' +
|
|
|
|
|
'}\n' +
|
|
|
|
|
'# in my line\n')
|
|
|
|
|
|
|
|
|
|
def test_loading_utf8_file(self):
|
|
|
|
|
tmp_file = tempfile.mkstemp('utf-8')[1]
|
|
|
|
|
shutil.copy('test-files/umlaut-utf8.conf', tmp_file)
|
|
|
|
|