##// END OF EJS Templates
First add the truncator (if there is none in the text itself), then closing tags
First add the truncator (if there is none in the text itself), then closing tags

File last commit:

r1482:f16bd5ef default
r1788:e1bfd1eb default
Show More
test_parser.py
35 lines | 1.2 KiB | text/x-python | PythonLexer
from django.test import TestCase
from boards.mdx_neboard import Parser
from boards.models import Post
class ParserTest(TestCase):
def test_preparse_quote(self):
raw_text = '>quote\nQuote in >line\nLine\n>Quote'
preparsed_text = Parser().preparse(raw_text)
self.assertEqual(
'[quote]quote[/quote]\nQuote in >line\nLine\n[quote]Quote[/quote]',
preparsed_text, 'Quote not preparsed.')
def test_preparse_comment(self):
raw_text = '//comment'
preparsed_text = Parser().preparse(raw_text)
self.assertEqual('[comment]comment[/comment]', preparsed_text,
'Comment not preparsed.')
def test_preparse_reflink(self):
raw_text = '>>12\nText'
preparsed_text = Parser().preparse(raw_text)
self.assertEqual('[post]12[/post]\nText',
preparsed_text, 'Reflink not preparsed.')
def test_preparse_user(self):
raw_text = '@user\nuser@example.com\n@user\nuser @user'
preparsed_text = Parser().preparse(raw_text)
self.assertEqual('[user]user[/user]\nuser@example.com\n[user]user[/user]\nuser [user]user[/user]',
preparsed_text, 'User link not preparsed.')