forked from jruby/jruby
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
spec/regression/GH-2182_struct_inspect_has_ascii_encoding_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- encoding: utf-8 -*- | ||
|
||
# https://github.com/jruby/jruby/issues/2182 | ||
if RUBY_VERSION > '1.9' | ||
describe 'Struct#inspect' do | ||
it 'returns correct value' do | ||
s1 = Struct.new(:aa).new("ΆἅἇἈ") | ||
s1.inspect.should == "#<struct aa=\"ΆἅἇἈ\">" | ||
s1.inspect.encoding.should == Encoding::UTF_8 | ||
|
||
s2 = Struct.new(:a, :b).new("ΆἅἇἈ", "abc") | ||
s2.inspect.should == "#<struct a=\"ΆἅἇἈ\", b=\"abc\">" | ||
s2.inspect.encoding.should == Encoding::UTF_8 | ||
|
||
s3 = Struct.new(:b).new("abc") | ||
s3.inspect.should == "#<struct b=\"abc\">" | ||
s3.inspect.encoding.should == Encoding::ASCII_8BIT | ||
end | ||
end | ||
end |