##// END OF EJS Templates
Don't run time conversion if Intl not available in browser. Also convert...
Don't run time conversion if Intl not available in browser. Also convert thread death time in archived threads

File last commit:

r1002:8af3de9c default
r1023:0040ea34 default
Show More
test_parser.py
34 lines | 1.2 KiB | text/x-python | PythonLexer
neko259
Added parser test. Fixed quote preparsing
r886 from django.test import TestCase
from boards.models import Post
class ParserTest(TestCase):
def test_preparse_quote(self):
neko259
Use multiline preparser (treat line breaks as line start)
r887 raw_text = '>quote\nQuote in >line\nLine\n>Quote'
neko259
Added parser test. Fixed quote preparsing
r886 preparsed_text = Post.objects._preparse_text(raw_text)
neko259
Use multiline preparser (treat line breaks as line start)
r887 self.assertEqual(
'[quote]quote[/quote]\nQuote in >line\nLine\n[quote]Quote[/quote]',
neko259
Preparse comment to bbcode
r888 preparsed_text, 'Quote not preparsed.')
def test_preparse_comment(self):
raw_text = '//comment'
preparsed_text = Post.objects._preparse_text(raw_text)
self.assertEqual('[comment]comment[/comment]', preparsed_text,
neko259
Fixed post reflinks that were parsed as quotes in the line start
r926 'Comment not preparsed.')
def test_preparse_reflink(self):
raw_text = '>>12\nText'
preparsed_text = Post.objects._preparse_text(raw_text)
self.assertEqual('[post]12[/post]\nText',
preparsed_text, 'Reflink not preparsed.')
neko259
Don't turn emails into user casts
r1002 def preparse_user(self):
raw_text = '@user\nuser@example.com\n@user\nuser @user'
preparsed_text = Post.objects._preparse_text(raw_text)
self.assertEqual('[user]user[/user]\nuser@example.com\n[user]user[/user]\nuser [user]user[/user]',
preparsed_text, 'User link not preparsed.')