⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (746 Bytes)
Bug #8255
» test_utf16.rb
arton (Akio Tajima)
, 04/11/2013 10:11 PM
require
'test/unit'
require
'tempfile'
class
TestUtf16
<
Test
::
Unit
::
TestCase
def
setup
p
'setup'
@tempfile
=
Tempfile
.
new
(
'utf16test'
)
@tempname
=
@tempfile
.
path
@tempfile
.
close!
File
.
open
(
@tempname
,
'wb:utf-16'
)
do
|
f
|
f
.
write
<<
EOF
This is not a love song.
This is not a love song.
EOF
end
end
def
teardown
p
'teardown'
File
.
delete
(
@tempname
)
end
def
test_hello
no_exception
=
true
File
.
open
(
@tempname
,
'rb:utf-16'
).
each_line
do
|
line
|
begin
assert_equals
'This is not a love song.'
,
line
.
rstrip
rescue
Encoding
::
CompatibilityError
=>
e
no_exception
=
false
end
end
.
close
assert
no_exception
end
end
« Previous
1
2
Next »
(1-1/2)
Loading...