From 9c73c756244fa27ffa99d81dcc73a4ad14198002 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 21 Dec 2020 01:16:26 +0900 Subject: Use Integer instead of Fixnum/Bignum --- spec/ruby/core/string/bytes_spec.rb | 6 +++--- spec/ruby/core/string/element_set_spec.rb | 10 +++++----- spec/ruby/core/string/index_spec.rb | 2 +- spec/ruby/core/string/ord_spec.rb | 4 ++-- spec/ruby/core/string/rindex_spec.rb | 2 +- spec/ruby/core/string/shared/codepoints.rb | 4 ++-- spec/ruby/core/string/to_i_spec.rb | 18 +++++++++--------- 7 files changed, 23 insertions(+), 23 deletions(-) (limited to 'spec/ruby/core/string') diff --git a/spec/ruby/core/string/bytes_spec.rb b/spec/ruby/core/string/bytes_spec.rb index 96f1ae9cf2..859b346550 100644 --- a/spec/ruby/core/string/bytes_spec.rb +++ b/spec/ruby/core/string/bytes_spec.rb @@ -22,9 +22,9 @@ describe "String#bytes" do @utf8_ascii.bytes.to_a.size.should == @utf8_ascii.bytesize end - it "returns bytes as Fixnums" do - @ascii.bytes.to_a.each {|b| b.should be_an_instance_of(Fixnum)} - @utf8_ascii.bytes { |b| b.should be_an_instance_of(Fixnum) } + it "returns bytes as Integers" do + @ascii.bytes.to_a.each {|b| b.should be_an_instance_of(Integer)} + @utf8_ascii.bytes { |b| b.should be_an_instance_of(Integer) } end it "agrees with #unpack('C*')" do diff --git a/spec/ruby/core/string/element_set_spec.rb b/spec/ruby/core/string/element_set_spec.rb index 641d46bc91..c9e02a7381 100644 --- a/spec/ruby/core/string/element_set_spec.rb +++ b/spec/ruby/core/string/element_set_spec.rb @@ -5,7 +5,7 @@ require_relative 'fixtures/classes' # TODO: Add missing String#[]= specs: # String#[re, idx] = obj -describe "String#[]= with Fixnum index" do +describe "String#[]= with Integer index" do it "replaces the char at idx with other_str" do a = "hello" a[0] = "bam" @@ -85,7 +85,7 @@ describe "String#[]= with Fixnum index" do -> { "test"[1] = nil }.should raise_error(TypeError) end - it "raises a TypeError if passed a Fixnum replacement" do + it "raises a TypeError if passed an Integer replacement" do -> { "abc"[1] = 65 }.should raise_error(TypeError) end @@ -102,7 +102,7 @@ describe "String#[]= with Fixnum index" do str.should == "あa" end - it "raises a TypeError if #to_int does not return an Fixnum" do + it "raises a TypeError if #to_int does not return an Integer" do index = mock("string element set") index.should_receive(:to_int).and_return('1') @@ -243,7 +243,7 @@ describe "String#[]= with a Regexp index" do str.should == "axc" end - it "raises a TypeError if #to_int does not return a Fixnum" do + it "raises a TypeError if #to_int does not return an Integer" do ref = mock("string element set regexp ref") ref.should_receive(:to_int).and_return(nil) @@ -438,7 +438,7 @@ describe "String#[]= with a Range index" do end end -describe "String#[]= with Fixnum index, count" do +describe "String#[]= with Integer index, count" do it "starts at idx and overwrites count characters before inserting the rest of other_str" do a = "hello" a[0, 2] = "xx" diff --git a/spec/ruby/core/string/index_spec.rb b/spec/ruby/core/string/index_spec.rb index ca62911db0..8d2c8af193 100644 --- a/spec/ruby/core/string/index_spec.rb +++ b/spec/ruby/core/string/index_spec.rb @@ -27,7 +27,7 @@ describe "String#index" do "abc".index("c", offset).should == 2 end - it "raises a TypeError if passed a Fixnum" do + it "raises a TypeError if passed an Integer" do -> { "abc".index 97 }.should raise_error(TypeError) end end diff --git a/spec/ruby/core/string/ord_spec.rb b/spec/ruby/core/string/ord_spec.rb index 0f5a3f6a37..cfc630a124 100644 --- a/spec/ruby/core/string/ord_spec.rb +++ b/spec/ruby/core/string/ord_spec.rb @@ -1,8 +1,8 @@ require_relative '../../spec_helper' describe "String#ord" do - it "returns a Fixnum" do - 'a'.ord.should be_an_instance_of(Fixnum) + it "returns an Integer" do + 'a'.ord.should be_an_instance_of(Integer) end it "returns the codepoint of the first character in the String" do diff --git a/spec/ruby/core/string/rindex_spec.rb b/spec/ruby/core/string/rindex_spec.rb index e021486bc2..7a6af0c9d0 100644 --- a/spec/ruby/core/string/rindex_spec.rb +++ b/spec/ruby/core/string/rindex_spec.rb @@ -4,7 +4,7 @@ require_relative 'fixtures/classes' require_relative 'fixtures/utf-8-encoding' describe "String#rindex with object" do - it "raises a TypeError if obj isn't a String, Fixnum or Regexp" do + it "raises a TypeError if obj isn't a String, Integer or Regexp" do not_supported_on :opal do -> { "hello".rindex(:sym) }.should raise_error(TypeError) end diff --git a/spec/ruby/core/string/shared/codepoints.rb b/spec/ruby/core/string/shared/codepoints.rb index e94a57f48e..0b2e078e0a 100644 --- a/spec/ruby/core/string/shared/codepoints.rb +++ b/spec/ruby/core/string/shared/codepoints.rb @@ -26,9 +26,9 @@ describe :string_codepoints, shared: true do -> { s.send(@method) { } }.should raise_error(ArgumentError) end - it "yields codepoints as Fixnums" do + it "yields codepoints as Integers" do "glark\u{20}".send(@method).to_a.each do |codepoint| - codepoint.should be_an_instance_of(Fixnum) + codepoint.should be_an_instance_of(Integer) end end diff --git a/spec/ruby/core/string/to_i_spec.rb b/spec/ruby/core/string/to_i_spec.rb index a37be47778..e4fa89aab3 100644 --- a/spec/ruby/core/string/to_i_spec.rb +++ b/spec/ruby/core/string/to_i_spec.rb @@ -131,29 +131,29 @@ describe "String#to_i" do -> { "".to_i(37) }.should raise_error(ArgumentError) end - it "returns a Fixnum for long strings with trailing spaces" do + it "returns an Integer for long strings with trailing spaces" do "0 ".to_i.should == 0 - "0 ".to_i.should be_an_instance_of(Fixnum) + "0 ".to_i.should be_an_instance_of(Integer) "10 ".to_i.should == 10 - "10 ".to_i.should be_an_instance_of(Fixnum) + "10 ".to_i.should be_an_instance_of(Integer) "-10 ".to_i.should == -10 - "-10 ".to_i.should be_an_instance_of(Fixnum) + "-10 ".to_i.should be_an_instance_of(Integer) end - it "returns a Fixnum for long strings with leading spaces" do + it "returns an Integer for long strings with leading spaces" do " 0".to_i.should == 0 - " 0".to_i.should be_an_instance_of(Fixnum) + " 0".to_i.should be_an_instance_of(Integer) " 10".to_i.should == 10 - " 10".to_i.should be_an_instance_of(Fixnum) + " 10".to_i.should be_an_instance_of(Integer) " -10".to_i.should == -10 - " -10".to_i.should be_an_instance_of(Fixnum) + " -10".to_i.should be_an_instance_of(Integer) end - it "returns the correct Bignum for long strings" do + it "returns the correct Integer for long strings" do "245789127594125924165923648312749312749327482".to_i.should == 245789127594125924165923648312749312749327482 "-245789127594125924165923648312749312749327482".to_i.should == -245789127594125924165923648312749312749327482 end -- cgit v1.2.3