summaryrefslogtreecommitdiff
path: root/spec/ruby/core/encoding
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/encoding')
-rw-r--r--spec/ruby/core/encoding/converter/asciicompat_encoding_spec.rb2
-rw-r--r--spec/ruby/core/encoding/converter/convert_spec.rb4
-rw-r--r--spec/ruby/core/encoding/converter/new_spec.rb10
-rw-r--r--spec/ruby/core/encoding/converter/primitive_convert_spec.rb24
-rw-r--r--spec/ruby/core/encoding/converter/primitive_errinfo_spec.rb4
-rw-r--r--spec/ruby/core/encoding/converter/replacement_spec.rb6
-rw-r--r--spec/ruby/core/encoding/converter/search_convpath_spec.rb2
-rw-r--r--spec/ruby/core/encoding/default_external_spec.rb4
-rw-r--r--spec/ruby/core/encoding/default_internal_spec.rb4
-rw-r--r--spec/ruby/core/encoding/find_spec.rb4
10 files changed, 32 insertions, 32 deletions
diff --git a/spec/ruby/core/encoding/converter/asciicompat_encoding_spec.rb b/spec/ruby/core/encoding/converter/asciicompat_encoding_spec.rb
index e39d590e3a..1beb40af3f 100644
--- a/spec/ruby/core/encoding/converter/asciicompat_encoding_spec.rb
+++ b/spec/ruby/core/encoding/converter/asciicompat_encoding_spec.rb
@@ -2,7 +2,7 @@ require_relative '../../../spec_helper'
describe "Encoding::Converter.asciicompat_encoding" do
it "accepts an encoding name as a String argument" do
- lambda { Encoding::Converter.asciicompat_encoding('UTF-8') }.
+ -> { Encoding::Converter.asciicompat_encoding('UTF-8') }.
should_not raise_error
end
diff --git a/spec/ruby/core/encoding/converter/convert_spec.rb b/spec/ruby/core/encoding/converter/convert_spec.rb
index 362e027a58..95a9e0b758 100644
--- a/spec/ruby/core/encoding/converter/convert_spec.rb
+++ b/spec/ruby/core/encoding/converter/convert_spec.rb
@@ -33,13 +33,13 @@ describe "Encoding::Converter#convert" do
it "raises UndefinedConversionError if the String contains characters invalid for the target encoding" do
ec = Encoding::Converter.new('UTF-8', Encoding.find('macCyrillic'))
- lambda { ec.convert("\u{6543}".force_encoding('UTF-8')) }.should \
+ -> { ec.convert("\u{6543}".force_encoding('UTF-8')) }.should \
raise_error(Encoding::UndefinedConversionError)
end
it "raises an ArgumentError if called on a finished stream" do
ec = Encoding::Converter.new('UTF-8', Encoding.find('macCyrillic'))
ec.finish
- lambda { ec.convert("\u{65}") }.should raise_error(ArgumentError)
+ -> { ec.convert("\u{65}") }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/encoding/converter/new_spec.rb b/spec/ruby/core/encoding/converter/new_spec.rb
index 6b9c76a093..6a6343012c 100644
--- a/spec/ruby/core/encoding/converter/new_spec.rb
+++ b/spec/ruby/core/encoding/converter/new_spec.rb
@@ -23,7 +23,7 @@ describe "Encoding::Converter.new" do
end
it "raises an Encoding::ConverterNotFoundError if both encodings are the same" do
- lambda do
+ -> do
Encoding::Converter.new "utf-8", "utf-8"
end.should raise_error(Encoding::ConverterNotFoundError)
end
@@ -65,25 +65,25 @@ describe "Encoding::Converter.new" do
obj = mock("encoding converter replacement")
obj.should_receive(:to_str).and_return(1)
- lambda do
+ -> do
Encoding::Converter.new("us-ascii", "utf-8", replace: obj)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed true for the replacement object" do
- lambda do
+ -> do
Encoding::Converter.new("us-ascii", "utf-8", replace: true)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed false for the replacement object" do
- lambda do
+ -> do
Encoding::Converter.new("us-ascii", "utf-8", replace: false)
end.should raise_error(TypeError)
end
it "raises a TypeError if passed a Fixnum for the replacement object" do
- lambda do
+ -> do
Encoding::Converter.new("us-ascii", "utf-8", replace: 1)
end.should raise_error(TypeError)
end
diff --git a/spec/ruby/core/encoding/converter/primitive_convert_spec.rb b/spec/ruby/core/encoding/converter/primitive_convert_spec.rb
index 710cc262bb..4a22606375 100644
--- a/spec/ruby/core/encoding/converter/primitive_convert_spec.rb
+++ b/spec/ruby/core/encoding/converter/primitive_convert_spec.rb
@@ -7,19 +7,19 @@ describe "Encoding::Converter#primitive_convert" do
end
it "accepts a nil source buffer" do
- lambda { @ec.primitive_convert(nil,"") }.should_not raise_error
+ -> { @ec.primitive_convert(nil,"") }.should_not raise_error
end
it "accepts a String as the source buffer" do
- lambda { @ec.primitive_convert("","") }.should_not raise_error
+ -> { @ec.primitive_convert("","") }.should_not raise_error
end
it "accepts nil for the destination byte offset" do
- lambda { @ec.primitive_convert("","", nil) }.should_not raise_error
+ -> { @ec.primitive_convert("","", nil) }.should_not raise_error
end
it "accepts an integer for the destination byte offset" do
- lambda { @ec.primitive_convert("","a", 1) }.should_not raise_error
+ -> { @ec.primitive_convert("","a", 1) }.should_not raise_error
end
it "calls #to_int to convert the destination byte offset" do
@@ -30,10 +30,10 @@ describe "Encoding::Converter#primitive_convert" do
end
it "raises an ArgumentError if the destination byte offset is greater than the bytesize of the destination buffer" do
- lambda { @ec.primitive_convert("","am", 0) }.should_not raise_error
- lambda { @ec.primitive_convert("","am", 1) }.should_not raise_error
- lambda { @ec.primitive_convert("","am", 2) }.should_not raise_error
- lambda { @ec.primitive_convert("","am", 3) }.should raise_error(ArgumentError)
+ -> { @ec.primitive_convert("","am", 0) }.should_not raise_error
+ -> { @ec.primitive_convert("","am", 1) }.should_not raise_error
+ -> { @ec.primitive_convert("","am", 2) }.should_not raise_error
+ -> { @ec.primitive_convert("","am", 3) }.should raise_error(ArgumentError)
end
it "uses the destination byte offset to determine where to write the result in the destination buffer" do
@@ -49,19 +49,19 @@ describe "Encoding::Converter#primitive_convert" do
end
it "accepts nil for the destination bytesize" do
- lambda { @ec.primitive_convert("","", nil, nil) }.should_not raise_error
+ -> { @ec.primitive_convert("","", nil, nil) }.should_not raise_error
end
it "accepts an integer for the destination bytesize" do
- lambda { @ec.primitive_convert("","", nil, 0) }.should_not raise_error
+ -> { @ec.primitive_convert("","", nil, 0) }.should_not raise_error
end
it "allows a destination bytesize value greater than the bytesize of the source buffer" do
- lambda { @ec.primitive_convert("am","", nil, 3) }.should_not raise_error
+ -> { @ec.primitive_convert("am","", nil, 3) }.should_not raise_error
end
it "allows a destination bytesize value less than the bytesize of the source buffer" do
- lambda { @ec.primitive_convert("am","", nil, 1) }.should_not raise_error
+ -> { @ec.primitive_convert("am","", nil, 1) }.should_not raise_error
end
it "calls #to_int to convert the destination byte size" do
diff --git a/spec/ruby/core/encoding/converter/primitive_errinfo_spec.rb b/spec/ruby/core/encoding/converter/primitive_errinfo_spec.rb
index e0a5378155..1f836b259f 100644
--- a/spec/ruby/core/encoding/converter/primitive_errinfo_spec.rb
+++ b/spec/ruby/core/encoding/converter/primitive_errinfo_spec.rb
@@ -54,7 +54,7 @@ describe "Encoding::Converter#primitive_errinfo" do
it "returns the state, source encoding, target encoding, erroneous bytes, and the read-again bytes when #convert last raised InvalidByteSequenceError" do
ec = Encoding::Converter.new("utf-8", "iso-8859-1")
- lambda { ec.convert("\xf1abcd") }.should raise_error(Encoding::InvalidByteSequenceError)
+ -> { ec.convert("\xf1abcd") }.should raise_error(Encoding::InvalidByteSequenceError)
ec.primitive_errinfo.should ==
[:invalid_byte_sequence, "UTF-8", "ISO-8859-1", "\xF1", "a"]
end
@@ -62,7 +62,7 @@ describe "Encoding::Converter#primitive_errinfo" do
it "returns the state, source encoding, target encoding, erroneous bytes, and the read-again bytes when #finish last raised InvalidByteSequenceError" do
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
ec.convert("\xa4")
- lambda { ec.finish }.should raise_error(Encoding::InvalidByteSequenceError)
+ -> { ec.finish }.should raise_error(Encoding::InvalidByteSequenceError)
ec.primitive_errinfo.should == [:incomplete_input, "EUC-JP", "UTF-8", "\xA4", ""]
end
end
diff --git a/spec/ruby/core/encoding/converter/replacement_spec.rb b/spec/ruby/core/encoding/converter/replacement_spec.rb
index a23be74e9b..5ca42e7e5a 100644
--- a/spec/ruby/core/encoding/converter/replacement_spec.rb
+++ b/spec/ruby/core/encoding/converter/replacement_spec.rb
@@ -33,7 +33,7 @@ describe "Encoding::Converter#replacement=" do
it "raises a TypeError if assigned a non-String argument" do
ec = Encoding::Converter.new("utf-8", "us-ascii")
- lambda { ec.replacement = nil }.should raise_error(TypeError)
+ -> { ec.replacement = nil }.should raise_error(TypeError)
end
it "sets #replacement" do
@@ -47,7 +47,7 @@ describe "Encoding::Converter#replacement=" do
ec = Encoding::Converter.new("sjis", "ascii")
utf8_q = "\u{986}".force_encoding('utf-8')
ec.primitive_convert(utf8_q.dup, "").should == :undefined_conversion
- lambda { ec.replacement = utf8_q }.should \
+ -> { ec.replacement = utf8_q }.should \
raise_error(Encoding::UndefinedConversionError)
end
@@ -55,7 +55,7 @@ describe "Encoding::Converter#replacement=" do
ec = Encoding::Converter.new("sjis", "ascii")
utf8_q = "\u{986}".force_encoding('utf-8')
ec.primitive_convert(utf8_q.dup, "").should == :undefined_conversion
- lambda { ec.replacement = utf8_q }.should \
+ -> { ec.replacement = utf8_q }.should \
raise_error(Encoding::UndefinedConversionError)
ec.replacement.should == "?".force_encoding('us-ascii')
end
diff --git a/spec/ruby/core/encoding/converter/search_convpath_spec.rb b/spec/ruby/core/encoding/converter/search_convpath_spec.rb
index bd7530405b..0535e7bdc3 100644
--- a/spec/ruby/core/encoding/converter/search_convpath_spec.rb
+++ b/spec/ruby/core/encoding/converter/search_convpath_spec.rb
@@ -25,7 +25,7 @@ describe "Encoding::Converter.search_convpath" do
end
it "raises an Encoding::ConverterNotFoundError if no conversion path exists" do
- lambda do
+ -> do
Encoding::Converter.search_convpath(Encoding::BINARY, Encoding::Emacs_Mule)
end.should raise_error(Encoding::ConverterNotFoundError)
end
diff --git a/spec/ruby/core/encoding/default_external_spec.rb b/spec/ruby/core/encoding/default_external_spec.rb
index 8973490901..e2cb9b02f4 100644
--- a/spec/ruby/core/encoding/default_external_spec.rb
+++ b/spec/ruby/core/encoding/default_external_spec.rb
@@ -54,10 +54,10 @@ describe "Encoding.default_external=" do
end
it "raises a TypeError unless the argument is an Encoding or convertible to a String" do
- lambda { Encoding.default_external = [] }.should raise_error(TypeError)
+ -> { Encoding.default_external = [] }.should raise_error(TypeError)
end
it "raises an ArgumentError if the argument is nil" do
- lambda { Encoding.default_external = nil }.should raise_error(ArgumentError)
+ -> { Encoding.default_external = nil }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/core/encoding/default_internal_spec.rb b/spec/ruby/core/encoding/default_internal_spec.rb
index 47a6887eee..855f4e9f32 100644
--- a/spec/ruby/core/encoding/default_internal_spec.rb
+++ b/spec/ruby/core/encoding/default_internal_spec.rb
@@ -60,11 +60,11 @@ describe "Encoding.default_internal=" do
obj = mock('string')
obj.should_receive(:to_str).at_least(1).times.and_return(1)
- lambda { Encoding.default_internal = obj }.should raise_error(TypeError)
+ -> { Encoding.default_internal = obj }.should raise_error(TypeError)
end
it "raises a TypeError when passed an object not providing #to_str" do
- lambda { Encoding.default_internal = mock("encoding") }.should raise_error(TypeError)
+ -> { Encoding.default_internal = mock("encoding") }.should raise_error(TypeError)
end
it "accepts an argument of nil to unset the default internal encoding" do
diff --git a/spec/ruby/core/encoding/find_spec.rb b/spec/ruby/core/encoding/find_spec.rb
index 5635a51c69..8a0873070f 100644
--- a/spec/ruby/core/encoding/find_spec.rb
+++ b/spec/ruby/core/encoding/find_spec.rb
@@ -18,7 +18,7 @@ describe "Encoding.find" do
end
it "raises a TypeError if passed a Symbol" do
- lambda { Encoding.find(:"utf-8") }.should raise_error(TypeError)
+ -> { Encoding.find(:"utf-8") }.should raise_error(TypeError)
end
it "returns the passed Encoding object" do
@@ -50,7 +50,7 @@ describe "Encoding.find" do
end
it "raises an ArgumentError if the given encoding does not exist" do
- lambda { Encoding.find('dh2dh278d') }.should raise_error(ArgumentError)
+ -> { Encoding.find('dh2dh278d') }.should raise_error(ArgumentError)
end
# Not sure how to do a better test, since locale depends on weird platform-specific stuff