Sha256: b240fbe7183a49fbd16993aeb1fa1cf481539c054e39b3af07fae454ac4f0590

Contents?: true

Size: 796 Bytes

Versions: 5

Compression:

Stored size: 796 Bytes

Contents

require 'helper'

class TestSlimEncoding < TestSlim
  def test_windows_crlf
    source = "a href='#' something\r\nbr\r\na href='#' others\r\n"
    result = "<a href=\"#\">something</a><br /><a href=\"#\">others</a>"
    assert_html result, source
  end

  def test_binary
    source = "| \xFF\xFF"
    source.force_encoding(Encoding::BINARY) if source.respond_to? :force_encoding

    result = "\xFF\xFF"
    result.force_encoding(Encoding::BINARY) if source.respond_to? :force_encoding

    out = render(source, :default_encoding => 'binary')
    out.force_encoding(Encoding::BINARY) if source.respond_to? :force_encoding

    assert_equal result, out
  end

  def test_bom
    source = "\xEF\xBB\xBFh1 Hello World!"
    result = '<h1>Hello World!</h1>'
    assert_html result, source
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slim-2.1.0 test/core/test_encoding.rb
slim-2.0.3 test/core/test_encoding.rb
slim-2.0.2 test/core/test_encoding.rb
slim-2.0.1 test/core/test_encoding.rb
slim-2.0.0 test/core/test_encoding.rb