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 -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'
require_relative 'shared/basic'

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'
require_relative 'shared/basic'

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'
require_relative 'shared/basic'
@ -47,8 +47,8 @@ describe "Array#pack with format 'B'" do
].should be_computed_by(:pack, "B*")
end
it "returns an ASCII-8BIT string" do
["1"].pack("B").encoding.should == Encoding::ASCII_8BIT
it "returns an BINARY string" do
["1"].pack("B").encoding.should == Encoding::BINARY
end
it "encodes the string as a sequence of bytes" do
@ -98,8 +98,8 @@ describe "Array#pack with format 'b'" do
].should be_computed_by(:pack, "b*")
end
it "returns an ASCII-8BIT string" do
["1"].pack("b").encoding.should == Encoding::ASCII_8BIT
it "returns an BINARY string" do
["1"].pack("b").encoding.should == Encoding::BINARY
end
it "encodes the string as a sequence of bytes" do

View file

@ -1,4 +1,4 @@
# encoding: ascii-8bit
# encoding: binary
require_relative '../../../spec_helper'

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'
require_relative 'shared/basic'
@ -97,8 +97,8 @@ describe "Array#pack with format 'H'" do
].should be_computed_by(:pack, "H")
end
it "returns an ASCII-8BIT string" do
["41"].pack("H").encoding.should == Encoding::ASCII_8BIT
it "returns an BINARY string" do
["41"].pack("H").encoding.should == Encoding::BINARY
end
end
@ -194,7 +194,7 @@ describe "Array#pack with format 'h'" do
].should be_computed_by(:pack, "h")
end
it "returns an ASCII-8BIT string" do
["41"].pack("h").encoding.should == Encoding::ASCII_8BIT
it "returns an BINARY string" do
["41"].pack("h").encoding.should == Encoding::BINARY
end
end

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'
require_relative 'shared/basic'

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

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'
require_relative 'shared/basic'

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'
require_relative 'shared/basic'
@ -36,7 +36,7 @@ describe "Array#pack with format 'w'" do
lambda { [-1].pack("w") }.should raise_error(ArgumentError)
end
it "returns an ASCII-8BIT string" do
[1].pack('w').encoding.should == Encoding::ASCII_8BIT
it "returns an BINARY string" do
[1].pack('w').encoding.should == Encoding::BINARY
end
end

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'
require_relative 'shared/basic'

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'
require_relative 'shared/basic'