Fix parsing of quoted strings in config.
[jelmer/dulwich.git] / dulwich / tests / test_config.py
index 87427a1725e384489a452d7d00c1a18806ef0dc8..a32d45cb822ae6f856ebaedbf8acd26c683610d6 100644 (file)
@@ -30,7 +30,9 @@ from dulwich.config import (
     _parse_string,
     _unescape_value,
     )
-from dulwich.tests import TestCase
+from dulwich.tests import (
+    TestCase,
+    )
 
 
 class ConfigFileTests(TestCase):
@@ -150,6 +152,7 @@ class ConfigFileTests(TestCase):
         cf = self.from_file(b"[branch.foo] foo = bar\n")
         self.assertEqual(b"bar", cf.get((b"branch", b"foo"), b"foo"))
 
+    #@expectedFailure
     def test_quoted(self):
         cf = self.from_file(b"""[gui]
        fontdiff = -family \\\"Ubuntu Mono\\\" -size 11 -weight normal -slant roman -underline 0 -overstrike 0
@@ -213,28 +216,12 @@ class ConfigDictTests(TestCase):
             list(cd.itersections()))
 
 
-
 class StackedConfigTests(TestCase):
 
     def test_default_backends(self):
         StackedConfig.default_backends()
 
 
-class UnescapeTests(TestCase):
-
-    def test_nothing(self):
-        self.assertEqual(b"", bytes(_unescape_value(bytearray())))
-
-    def test_tab(self):
-        self.assertEqual(b"\tbar\t", bytes(_unescape_value(bytearray(b"\\tbar\\t"))))
-
-    def test_newline(self):
-        self.assertEqual(b"\nbar\t", bytes(_unescape_value(bytearray(b"\\nbar\\t"))))
-
-    def test_quote(self):
-        self.assertEqual(b"\"foo\"", bytes(_unescape_value(bytearray(b"\\\"foo\\\""))))
-
-
 class EscapeValueTests(TestCase):
 
     def test_nothing(self):
@@ -268,6 +255,18 @@ class ParseStringTests(TestCase):
         self.assertEqual(b'foo', _parse_string(b"foo"))
         self.assertEqual(b'foo bar', _parse_string(b"foo bar"))
 
+    def test_nothing(self):
+        self.assertEqual(b"", _parse_string(b''))
+
+    def test_tab(self):
+        self.assertEqual(b"\tbar\t", _parse_string(b"\\tbar\\t"))
+
+    def test_newline(self):
+        self.assertEqual(b"\nbar\t", _parse_string(b"\\nbar\\t\t"))
+
+    def test_quote(self):
+        self.assertEqual(b"\"foo\"", _parse_string(b"\\\"foo\\\""))
+
 
 class CheckVariableNameTests(TestCase):