mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@94d98ff
This commit is contained in:
parent
632a97227e
commit
a2091c3023
10 changed files with 18 additions and 18 deletions
|
@ -47,7 +47,7 @@ describe "Array#pack with format 'B'" do
|
||||||
].should be_computed_by(:pack, "B*")
|
].should be_computed_by(:pack, "B*")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns an BINARY string" do
|
it "returns a binary string" do
|
||||||
["1"].pack("B").encoding.should == Encoding::BINARY
|
["1"].pack("B").encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ describe "Array#pack with format 'b'" do
|
||||||
].should be_computed_by(:pack, "b*")
|
].should be_computed_by(:pack, "b*")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns an BINARY string" do
|
it "returns a binary string" do
|
||||||
["1"].pack("b").encoding.should == Encoding::BINARY
|
["1"].pack("b").encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ describe "Array#pack with format 'H'" do
|
||||||
].should be_computed_by(:pack, "H")
|
].should be_computed_by(:pack, "H")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns an BINARY string" do
|
it "returns a binary string" do
|
||||||
["41"].pack("H").encoding.should == Encoding::BINARY
|
["41"].pack("H").encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -194,7 +194,7 @@ describe "Array#pack with format 'h'" do
|
||||||
].should be_computed_by(:pack, "h")
|
].should be_computed_by(:pack, "h")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns an BINARY string" do
|
it "returns a binary string" do
|
||||||
["41"].pack("h").encoding.should == Encoding::BINARY
|
["41"].pack("h").encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ describe :array_pack_numeric_basic, shared: true do
|
||||||
lambda { [false].pack(pack_format) }.should raise_error(TypeError)
|
lambda { [false].pack(pack_format) }.should raise_error(TypeError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns an BINARY string" do
|
it "returns a binary string" do
|
||||||
[0xFF].pack(pack_format).encoding.should == Encoding::BINARY
|
[0xFF].pack(pack_format).encoding.should == Encoding::BINARY
|
||||||
[0xE3, 0x81, 0x82].pack(pack_format(3)).encoding.should == Encoding::BINARY
|
[0xE3, 0x81, 0x82].pack(pack_format(3)).encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,7 +36,7 @@ describe "Array#pack with format 'w'" do
|
||||||
lambda { [-1].pack("w") }.should raise_error(ArgumentError)
|
lambda { [-1].pack("w") }.should raise_error(ArgumentError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns an BINARY string" do
|
it "returns a binary string" do
|
||||||
[1].pack('w').encoding.should == Encoding::BINARY
|
[1].pack('w').encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,7 +30,7 @@ describe "Integer#chr without argument" do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "and self is between 128 and 255 (inclusive)" do
|
describe "and self is between 128 and 255 (inclusive)" do
|
||||||
it "returns an BINARY String" do
|
it "returns a binary String" do
|
||||||
(128..255).each do |c|
|
(128..255).each do |c|
|
||||||
c.chr.encoding.should == Encoding::BINARY
|
c.chr.encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
|
@ -81,7 +81,7 @@ describe "Integer#chr without argument" do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "and self is between 128 and 255 (inclusive)" do
|
describe "and self is between 128 and 255 (inclusive)" do
|
||||||
it "returns an BINARY String" do
|
it "returns a binary String" do
|
||||||
(128..255).each do |c|
|
(128..255).each do |c|
|
||||||
Encoding.default_internal = Encoding::UTF_8
|
Encoding.default_internal = Encoding::UTF_8
|
||||||
c.chr.encoding.should == Encoding::BINARY
|
c.chr.encoding.should == Encoding::BINARY
|
||||||
|
|
|
@ -4,7 +4,7 @@ describe :proc_to_s, shared: true do
|
||||||
Proc.new { "hello" }.send(@method).should =~ /^#<Proc:([^ ]*?)(@([^ ]*)\/to_s\.rb:4)?>$/
|
Proc.new { "hello" }.send(@method).should =~ /^#<Proc:([^ ]*?)(@([^ ]*)\/to_s\.rb:4)?>$/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has an BINARY encoding" do
|
it "has a binary encoding" do
|
||||||
Proc.new { "hello" }.send(@method).encoding.should == Encoding::BINARY
|
Proc.new { "hello" }.send(@method).encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -14,7 +14,7 @@ describe :proc_to_s, shared: true do
|
||||||
lambda { "hello" }.send(@method).should =~ /^#<Proc:([^ ]*?)(@([^ ]*)\/to_s\.rb:10)? \(lambda\)>$/
|
lambda { "hello" }.send(@method).should =~ /^#<Proc:([^ ]*?)(@([^ ]*)\/to_s\.rb:10)? \(lambda\)>$/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has an BINARY encoding" do
|
it "has a binary encoding" do
|
||||||
lambda { "hello" }.send(@method).encoding.should == Encoding::BINARY
|
lambda { "hello" }.send(@method).encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -24,7 +24,7 @@ describe :proc_to_s, shared: true do
|
||||||
proc { "hello" }.send(@method).should =~ /^#<Proc:([^ ]*?)(@([^ ]*)\/to_s\.rb:16)?>$/
|
proc { "hello" }.send(@method).should =~ /^#<Proc:([^ ]*?)(@([^ ]*)\/to_s\.rb:16)?>$/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has an BINARY encoding" do
|
it "has a binary encoding" do
|
||||||
proc { "hello" }.send(@method).encoding.should == Encoding::BINARY
|
proc { "hello" }.send(@method).encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -35,7 +35,7 @@ describe :proc_to_s, shared: true do
|
||||||
method("hello").to_proc.send(@method).should =~ /^#<Proc:([^ ]*?)(@([^ ]*)\/to_s\.rb:22)? \(lambda\)>$/
|
method("hello").to_proc.send(@method).should =~ /^#<Proc:([^ ]*?)(@([^ ]*)\/to_s\.rb:22)? \(lambda\)>$/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has an BINARY encoding" do
|
it "has a binary encoding" do
|
||||||
def hello; end
|
def hello; end
|
||||||
method("hello").to_proc.send(@method).encoding.should == Encoding::BINARY
|
method("hello").to_proc.send(@method).encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
|
@ -47,7 +47,7 @@ describe :proc_to_s, shared: true do
|
||||||
proc.send(@method).should =~ /^#<Proc:0x\h+\(&:foobar\)>$/
|
proc.send(@method).should =~ /^#<Proc:0x\h+\(&:foobar\)>$/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has an BINARY encoding" do
|
it "has a binary encoding" do
|
||||||
proc = :foobar.to_proc
|
proc = :foobar.to_proc
|
||||||
proc.send(@method).encoding.should == Encoding::BINARY
|
proc.send(@method).encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe :random_bytes, shared: true do
|
||||||
@object.bytes(15).length.should == 15
|
@object.bytes(15).length.should == 15
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns an BINARY String" do
|
it "returns a binary String" do
|
||||||
@object.bytes(15).encoding.should == Encoding::BINARY
|
@object.bytes(15).encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ describe :random_urandom, shared: true do
|
||||||
}.should raise_error(ArgumentError)
|
}.should raise_error(ArgumentError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns an BINARY String" do
|
it "returns a binary String" do
|
||||||
Random.send(@method, 15).encoding.should == Encoding::BINARY
|
Random.send(@method, 15).encoding.should == Encoding::BINARY
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
require_relative '../../spec_helper'
|
require_relative '../../spec_helper'
|
||||||
|
|
||||||
describe "String#b" do
|
describe "String#b" do
|
||||||
it "returns an BINARY encoded string" do
|
it "returns a binary encoded string" do
|
||||||
"Hello".b.should == "Hello".force_encoding(Encoding::BINARY)
|
"Hello".b.should == "Hello".force_encoding(Encoding::BINARY)
|
||||||
"こんちには".b.should == "こんちには".force_encoding(Encoding::BINARY)
|
"こんちには".b.should == "こんちには".force_encoding(Encoding::BINARY)
|
||||||
end
|
end
|
||||||
|
|
|
@ -676,7 +676,7 @@ describe :rb_external_str_new, shared: true do
|
||||||
@s.send(@method, "abc").encoding.should == Encoding::UTF_8
|
@s.send(@method, "abc").encoding.should == Encoding::UTF_8
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns an BINARY encoded string if any non-ascii bytes are present and default external is US-ASCII" do
|
it "returns a binary encoded string if any non-ascii bytes are present and default external is US-ASCII" do
|
||||||
Encoding.default_external = "US-ASCII"
|
Encoding.default_external = "US-ASCII"
|
||||||
x80 = [0x80].pack('C')
|
x80 = [0x80].pack('C')
|
||||||
@s.send(@method, "#{x80}abc").encoding.should == Encoding::BINARY
|
@s.send(@method, "#{x80}abc").encoding.should == Encoding::BINARY
|
||||||
|
@ -735,7 +735,7 @@ describe "C-API String function" do
|
||||||
s.encoding.should == Encoding::UTF_8
|
s.encoding.should == Encoding::UTF_8
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns an BINARY encoded String if any non-ascii bytes are present and the specified encoding is US-ASCII" do
|
it "returns a binary encoded String if any non-ascii bytes are present and the specified encoding is US-ASCII" do
|
||||||
x80 = [0x80].pack('C')
|
x80 = [0x80].pack('C')
|
||||||
s = @s.rb_external_str_new_with_enc("#{x80}abc", 4, Encoding::US_ASCII)
|
s = @s.rb_external_str_new_with_enc("#{x80}abc", 4, Encoding::US_ASCII)
|
||||||
s.encoding.should == Encoding::BINARY
|
s.encoding.should == Encoding::BINARY
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue