aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Vilcans <martin@librador.com>2011-11-22 20:28:08 +0100
committerMartin Vilcans <martin@librador.com>2011-11-22 20:30:53 +0100
commit179bd424ee8b5a01584cd4cd7d76df8ba8a1f3d4 (patch)
tree751074aba0c6be2854cdf35af38fe389a6ed99ad /tests
parentbce1a38322327256ad2b718269d43371236d0bb7 (diff)
downloadscreenplain-179bd424ee8b5a01584cd4cd7d76df8ba8a1f3d4.tar.gz
Fix incorrectly parsing when mixing italic and bold. Thx, Stu!
Diffstat (limited to 'tests')
-rw-r--r--tests/richstring_test.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/richstring_test.py b/tests/richstring_test.py
index c79981d..2804ec2 100644
--- a/tests/richstring_test.py
+++ b/tests/richstring_test.py
@@ -126,7 +126,6 @@ class ParseEmphasisTests(unittest2.TestCase):
(bold + italic)('really strong')
)
- @unittest2.expectedFailure
def test_additional_star(self):
self.assertEquals(
parse_emphasis('*foo* bar* baz'),
@@ -152,3 +151,30 @@ class ParseEmphasisTests(unittest2.TestCase):
parse_emphasis('_*he_llo*'),
(italic + underline)('he') + italic('llo')
)
+
+ def test_complicated(self):
+ # As reported by Stu
+ self.assertEquals(
+ parse_emphasis('You can _underline_ words, make them **bold** or *italic* or even ***bold italic.***'),
+ (plain('You can ') + underline('underline') +
+ plain(' words, make them ') + bold('bold') + plain(' or ') +
+ italic('italic') + plain(' or even ') + (bold + italic)('bold italic.'))
+ )
+
+ def test_simplified_complicated(self):
+ self.assertEquals(
+ parse_emphasis('*italic* or even ***bold italic.***'),
+ italic('italic') + plain(' or even ') + (bold + italic)('bold italic.')
+ )
+
+ def test_two_italic_should_not_create_one_long_italic_string(self):
+ self.assertEquals(
+ parse_emphasis('*first* *second*'),
+ italic('first') + plain(' ') + italic('second')
+ )
+
+ def test_two_bold_should_not_create_one_long_bold_string(self):
+ self.assertEquals(
+ parse_emphasis('**first** **second**'),
+ bold('first') + plain(' ') + bold('second')
+ )