diff options
| author | Bob Halley <halley@dnspython.org> | 2020-07-23 19:21:16 -0700 |
|---|---|---|
| committer | Bob Halley <halley@dnspython.org> | 2020-07-23 19:21:16 -0700 |
| commit | cec586beb61ea9303492f52db7ca44a2f841bfa1 (patch) | |
| tree | 1482a03a721b83001bbbc5c0135414bc9cba4567 /tests/test_rdata.py | |
| parent | d743fc42dac24f1427237d40892fdf40e09bf575 (diff) | |
| download | dnspython-cec586beb61ea9303492f52db7ca44a2f841bfa1.tar.gz | |
Allow an escaped newline in a quoted string.
Diffstat (limited to 'tests/test_rdata.py')
| -rw-r--r-- | tests/test_rdata.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_rdata.py b/tests/test_rdata.py index 40f6f8d..ca509b8 100644 --- a/tests/test_rdata.py +++ b/tests/test_rdata.py @@ -459,6 +459,14 @@ class RdataTestCase(unittest.TestCase): self.assertEqual(mx, expected_mx) self.assertIsNone(mx.rdcomment) + def test_escaped_newline_in_quoted_string(self): + rd = dns.rdata.from_text('in', 'txt', '"foo\\\nbar"') + self.assertEqual(rd.strings, (b'foo\nbar',)) + self.assertEqual(rd.to_text(), '"foo\\010bar"') + + def test_escaped_newline_in_nonquoted_string(self): + with self.assertRaises(dns.exception.UnexpectedEnd): + dns.rdata.from_text('in', 'txt', 'foo\\\nbar') if __name__ == '__main__': unittest.main() |
