Sha256: d13cdcfcf26c92794601a14485f8102d1082fe3ffed90e6ac58bb900f4d0ec81
Contents?: true
Size: 973 Bytes
Versions: 5
Compression:
Stored size: 973 Bytes
Contents
# encoding: binary require 'helper' class TestEncoding < MiniTest::Unit::TestCase def recognize(string) Parser::Source::Buffer.recognize_encoding(string) end if defined?(Encoding) def test_default assert_equal Encoding::BINARY, recognize("foobar") end def test_bom assert_equal Encoding::UTF_8, recognize("\xef\xbb\xbffoobar") end def test_magic_comment assert_equal Encoding::KOI8_R, recognize("# coding:koi8-r\nfoobar") end def test_shebang assert_equal Encoding::KOI8_R, recognize("#!/bin/foo\n# coding:koi8-r\nfoobar") end def test_empty assert_equal Encoding::BINARY, recognize("") end def test_no_comment assert_equal Encoding::BINARY, recognize(%{require 'cane/encoding_aware_iterator'}) end def test_adjacent assert_equal Encoding::BINARY, recognize("# codingkoi8-r") assert_equal Encoding::BINARY, recognize("# coding koi8-r") end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
parser-1.4.2 | test/test_encoding.rb |
parser-1.4.1 | test/test_encoding.rb |
parser-2.0.0.beta1 | test/test_encoding.rb |
parser-1.4.0 | test/test_encoding.rb |
parser-1.3.4 | test/test_encoding.rb |