45405fc97e
The new sanitizer seems to work well (cuts the time required to produce the Instiki Atom feed in half). Our strategy is to use HTML5lib for <nowiki> content, but to use the new sanitizer for content that has been processed by Maruku (and hence is well-formed). The one broken unit test won't affect us (since it dealt with very malformed HTML).
27 lines
767 B
Ruby
Executable file
27 lines
767 B
Ruby
Executable file
#!/usr/bin/env ruby
|
|
|
|
require File.dirname(__FILE__) + '/../../test_helper'
|
|
require 'chunks/nowiki'
|
|
|
|
class NoWikiTest < Test::Unit::TestCase
|
|
include ChunkMatch
|
|
|
|
def test_simple_nowiki
|
|
match(NoWiki, 'This sentence contains <nowiki>[[raw text]]</nowiki>. Do not touch!',
|
|
:plain_text => '[[raw text]]'
|
|
)
|
|
end
|
|
|
|
def test_markdown_nowiki
|
|
match(NoWiki, 'This sentence contains <nowiki>*raw text*</nowiki>. Do not touch!',
|
|
:plain_text => '*raw text*'
|
|
)
|
|
end
|
|
|
|
def test_sanitize_nowiki
|
|
match(NoWiki, 'This sentence contains <nowiki>[[test]]&<a href="a&b">shebang</a> <script>alert("xss!");</script> *foo*</nowiki>. Do not touch!',
|
|
:plain_text => "[[test]]&<a href='a&b'>shebang</a> <script>alert(\"xss!\");</script> *foo*"
|
|
)
|
|
end
|
|
|
|
end
|