File: string_test.rb

package info (click to toggle)
libhtmlentities-ruby 4.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 136 kB
  • ctags: 294
  • sloc: ruby: 2,172; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 652 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'htmlentities/string'
require 'test/unit'

$KCODE = 'u'

class TestHTMLEntities < Test::Unit::TestCase
  
  def test_string_responds_correctly_to_decode_entities
    assert_equal('±', '&plusmn;'.decode_entities)
  end

  def test_string_responds_correctly_to_encode_entities_with_no_parameters
    assert_equal('&quot;', '"'.encode_entities)
  end

  def test_string_responds_correctly_to_encode_entities_with_multiple_parameters
    assert_equal(
      '&quot;bient&ocirc;t&quot; &amp; &#x6587;&#x5b57;',
      '"bientôt" & 文字'.encode_entities(:basic, :named, :hexadecimal)
    )
  end

end