diff --git a/tests/03-links.org b/tests/03-links.org index 7683c7f..ad38d7a 100644 --- a/tests/03-links.org +++ b/tests/03-links.org @@ -17,3 +17,7 @@ This is [[id:03-markup-first-level-id][a link to a section by id]]. This is a [[https://codigoparallevar.com/3][web link]] followed up with some text. + + This is a [[https://codigoparallevar.com/4][[tricky web link]​]] followed up with some text. + + This is [[[https://codigoparallevar.com/5][another tricky web link]]] followed up with some text. diff --git a/tests/test_org.py b/tests/test_org.py index 7e16f4e..8f8d484 100644 --- a/tests/test_org.py +++ b/tests/test_org.py @@ -201,7 +201,7 @@ class TestSerde(unittest.TestCase): doc = load(f) links = list(doc.get_links()) - self.assertEqual(len(links), 5) + self.assertEqual(len(links), 7) self.assertEqual(links[0].value, "https://codigoparallevar.com/1") self.assertEqual(links[0].description, "web link") @@ -217,6 +217,12 @@ class TestSerde(unittest.TestCase): self.assertEqual(links[4].value, "https://codigoparallevar.com/3") self.assertEqual(links[4].description, "web link") + self.assertEqual(links[5].value, "https://codigoparallevar.com/4") + self.assertEqual(links[5].description, "[tricky web link]") + + self.assertEqual(links[5].value, "https://codigoparallevar.com/5") + self.assertEqual(links[5].description, "another tricky web link") + ex = Doc( props=[ ("TITLE", "03-Links"), @@ -270,6 +276,18 @@ class TestSerde(unittest.TestCase): WEB_LINK("web link", "https://codigoparallevar.com/3"), " followed up with some text.\n", ), + SPAN("\n"), + SPAN( + " This is a ", + WEB_LINK("[tricky web link]", "https://codigoparallevar.com/4"), + " followed up with some text.\n", + ), + SPAN("\n"), + SPAN( + " This is [", + WEB_LINK("another tricky web link", "https://codigoparallevar.com/4"), + "] followed up with some text.\n", + ), ], ) ), @@ -282,7 +300,7 @@ class TestSerde(unittest.TestCase): doc = load(f) links = list(doc.get_links()) - self.assertEqual(len(links), 5) + self.assertEqual(len(links), 7) self.assertEqual(links[0].value, "https://codigoparallevar.com/1") self.assertEqual(links[0].description, "web link") links[0].value = "https://codigoparallevar.com/1-updated" @@ -308,6 +326,16 @@ class TestSerde(unittest.TestCase): links[4].value = "https://codigoparallevar.com/3-updated" links[4].description = "web link #3 with update" + self.assertEqual(links[5].value, "https://codigoparallevar.com/4") + self.assertEqual(links[5].description, "[tricky web link]") + links[5].value = "https://codigoparallevar.com/4-updated" + links[5].description = "[tricky web link #4 with update]" + + self.assertEqual(links[6].value, "https://codigoparallevar.com/5") + self.assertEqual(links[6].description, "another tricky web link") + links[6].value = "https://codigoparallevar.com/5-updated" + links[6].description = "another tricky web link #5 with update" + ex = Doc( props=[ ("TITLE", "03-Links"), @@ -368,6 +396,24 @@ class TestSerde(unittest.TestCase): ), " followed up with some text.\n", ), + SPAN("\n"), + SPAN( + " This is a ", + WEB_LINK( + "[tricky web link #4 with update]", + "https://codigoparallevar.com/4-updated", + ), + " followed up with some text.\n", + ), + SPAN("\n"), + SPAN( + " This is [", + WEB_LINK( + "another tricky web link #5 with update", + "https://codigoparallevar.com/5-updated", + ), + "] followed up with some text.\n", + ), ], ) ),