Class: TestHtmlFilter
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- TestHtmlFilter
- Defined in:
- lib/raw/util/html_filter.rb
Instance Method Summary collapse
- #assert_filter(filtered, original) ⇒ Object
- #test_balancing_tags ⇒ Object
- #test_basics ⇒ Object
- #test_end_slashes ⇒ Object
- #test_fix_quotes ⇒ Object
- #test_strip_single ⇒ Object
- #test_tag_completion ⇒ Object
Instance Method Details
#assert_filter(filtered, original) ⇒ Object
498 499 500 |
# File 'lib/raw/util/html_filter.rb', line 498 def assert_filter(filtered, original) assert_equal(filtered, original.html_filter) end |
#test_balancing_tags ⇒ Object
511 512 513 514 515 516 517 |
# File 'lib/raw/util/html_filter.rb', line 511 def assert_filter "<b>hello</b>", "<<b>hello</b>" assert_filter "<b>hello</b>", "<b>>hello</b>" assert_filter "<b>hello</b>", "<b>hello<</b>" assert_filter "<b>hello</b>", "<b>hello</b>>" assert_filter "", "<>" end |
#test_basics ⇒ Object
506 507 508 509 |
# File 'lib/raw/util/html_filter.rb', line 506 def test_basics assert_filter '', '' assert_filter 'hello', 'hello' end |
#test_end_slashes ⇒ Object
530 531 532 533 534 |
# File 'lib/raw/util/html_filter.rb', line 530 def test_end_slashes assert_filter '<img />', '<img>' assert_filter '<img />', '<img/>' assert_filter '', '<b/></b>' end |
#test_fix_quotes ⇒ Object
502 503 504 |
# File 'lib/raw/util/html_filter.rb', line 502 def test_fix_quotes assert_filter '<img src="foo.jpg" />', "<img src=\"foo.jpg />" end |
#test_strip_single ⇒ Object
492 493 494 495 496 |
# File 'lib/raw/util/html_filter.rb', line 492 def test_strip_single hf = HtmlFilter.new assert_equal( '"', hf.send(:strip_single,'\"') ) assert_equal( "\000", hf.send(:strip_single,'\0') ) end |
#test_tag_completion ⇒ Object
519 520 521 522 523 524 525 526 527 528 |
# File 'lib/raw/util/html_filter.rb', line 519 def test_tag_completion assert_filter "hello", "hello<b>" assert_filter "<b>hello</b>", "<b>hello" assert_filter "hello<b>world</b>", "hello<b>world" assert_filter "hello", "hello</b>" assert_filter "hello", "hello<b/>" assert_filter "hello<b>world</b>", "hello<b/>world" assert_filter "<b><b><b>hello</b></b></b>", "<b><b><b>hello" assert_filter "", "</b><b>" end |