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'
@ -32,7 +32,7 @@ describe "String#unpack with format 'A'" do
it "decodes into raw (ascii) string values" do
str = "str".force_encoding('UTF-8').unpack("A*")[0]
str.encoding.name.should == 'ASCII-8BIT'
str.encoding.should == Encoding::BINARY
end
end
@ -60,7 +60,7 @@ describe "String#unpack with format 'a'" do
it "decodes into raw (ascii) string values" do
str = "".unpack("a*")[0]
str.encoding.name.should == 'ASCII-8BIT'
str.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'

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'

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'
require_relative 'shared/basic'
@ -63,6 +63,10 @@ describe "String#unpack with format 'H'" do
it "ignores spaces between directives" do
"\x01\x10".unpack("H H").should == ["0", "1"]
end
it "should make strings with US_ASCII encoding" do
"\x01".unpack("H")[0].encoding.should == Encoding::US_ASCII
end
end
describe "String#unpack with format 'h'" do
@ -124,4 +128,8 @@ describe "String#unpack with format 'h'" do
it "ignores spaces between directives" do
"\x01\x10".unpack("h h").should == ["1", "0"]
end
it "should make strings with US_ASCII encoding" do
"\x01".unpack("h")[0].encoding.should == Encoding::US_ASCII
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 :string_unpack_float_le, shared: true do
it "decodes one float for a single format character" do

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
describe :string_unpack_16bit_le, shared: true do
it "decodes one short for a single format character" do

View file

@ -1,4 +1,4 @@
# -*- encoding: ascii-8bit -*-
# -*- encoding: binary -*-
require_relative '../../../spec_helper'
require_relative '../fixtures/classes'
require_relative 'shared/basic'
@ -31,10 +31,10 @@ describe "String#unpack with format 'u'" do
it "decodes into raw (ascii) string values" do
str = "".unpack("u")[0]
str.encoding.name.should == 'ASCII-8BIT'
str.encoding.should == Encoding::BINARY
str = "1".force_encoding('UTF-8').unpack("u")[0]
str.encoding.name.should == 'ASCII-8BIT'
str.encoding.should == Encoding::BINARY
end
it "decodes the complete string ignoring newlines when given a single directive" do

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'