1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-06-27 21:02:36 +02:00
parent c940397116
commit d80e44deec
157 changed files with 581 additions and 543 deletions

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
describe :array_pack_float_le, shared: true do
it "encodes a positive Float" do

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
describe :array_pack_16bit_le, shared: true do
it "encodes the least significant 16 bits of a positive number" do

View file

@ -15,9 +15,9 @@ describe :array_pack_numeric_basic, shared: true do
lambda { [false].pack(pack_format) }.should raise_error(TypeError)
end
it "returns an ASCII-8BIT string" do
[0xFF].pack(pack_format).encoding.should == Encoding::ASCII_8BIT
[0xE3, 0x81, 0x82].pack(pack_format(3)).encoding.should == Encoding::ASCII_8BIT
it "returns an BINARY string" do
[0xFF].pack(pack_format).encoding.should == Encoding::BINARY
[0xE3, 0x81, 0x82].pack(pack_format(3)).encoding.should == Encoding::BINARY
end
end

View file

@ -38,11 +38,11 @@ describe :array_pack_string, shared: true do
it "returns a string in encoding of common to the concatenated results" do
f = pack_format("*")
[ [["\u{3042 3044 3046 3048}", 0x2000B].pack(f+"U"), Encoding::ASCII_8BIT],
[["abcde\xd1", "\xFF\xFe\x81\x82"].pack(f+"u"), Encoding::ASCII_8BIT],
[["a".force_encoding("ascii"), "\xFF\xFe\x81\x82"].pack(f+"u"), Encoding::ASCII_8BIT],
[ [["\u{3042 3044 3046 3048}", 0x2000B].pack(f+"U"), Encoding::BINARY],
[["abcde\xd1", "\xFF\xFe\x81\x82"].pack(f+"u"), Encoding::BINARY],
[["a".force_encoding("ascii"), "\xFF\xFe\x81\x82"].pack(f+"u"), Encoding::BINARY],
# under discussion [ruby-dev:37294]
[["\u{3042 3044 3046 3048}", 1].pack(f+"N"), Encoding::ASCII_8BIT]
[["\u{3042 3044 3046 3048}", 1].pack(f+"N"), Encoding::BINARY]
].should be_computed_by(:encoding)
end
end