Sha256: b68b8e23d25955ecca3baf663dd656a1712e1380f6fc120bec11dacd0483f017
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
=begin Copyright © 2007 John Vorhauer Contact me at langa@vorhauer.de near 50°55'N+6°55'E. This file is part of Langa. Langa is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Langa is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Langa. If not, see <http://www.gnu.org/licenses/>. For a detailed functional description of Langa see the README file =end $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') require 'rubygems' require 'test/unit' require 'langa/file.rb' class TestLanguages < Test::Unit::TestCase def test_open assert_kind_of(File, File.open('tc_file.rb')) assert_kind_of(File, File.open(['tc_file.rb', '8859-1'])) assert_raise(RuntimeError) { File.open(['tc_file.rb', '8859-1'], 'w') } end def test_each_unicode uca = [] File.open(['tc_file.rb', '8859-1']).each_unicode { |uc| uca << "%02x" % [uc] } hex_text = '3d626567696e0a0a2020436f7079726967687420c2a92032303037204a6f686e20566f7268617565720a2020436f6e74616374206d65206174206c616e676140766f7268617565722e6465206e656172203530c2b03535274e2b36c2b0353527452e0a20' assert_equal(hex_text, uca[0...100].join) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
langa-1.0.0 | test/tc_file.rb |