aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/string/ljust_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-04-28 23:20:11 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-04-28 23:20:11 +0200
commit79671ec57e59091260a0bc3d40a31d31d9c72a94 (patch)
tree2f59a8727b8f63f9e79d50352fa4f78a7cc00234 /spec/ruby/core/string/ljust_spec.rb
parent994833085ae06afbe94d30ab183d80e0234fbe14 (diff)
downloadruby-79671ec57e59091260a0bc3d40a31d31d9c72a94.tar.gz
Update to ruby/spec@7de852d
Diffstat (limited to 'spec/ruby/core/string/ljust_spec.rb')
-rw-r--r--spec/ruby/core/string/ljust_spec.rb42
1 files changed, 20 insertions, 22 deletions
diff --git a/spec/ruby/core/string/ljust_spec.rb b/spec/ruby/core/string/ljust_spec.rb
index 5838a0c9f9..a8160c727b 100644
--- a/spec/ruby/core/string/ljust_spec.rb
+++ b/spec/ruby/core/string/ljust_spec.rb
@@ -87,30 +87,28 @@ describe "String#ljust with length, padding" do
"hello".ljust(6, 'X'.taint).tainted?.should be_true
end
- with_feature :encoding do
- describe "with width" do
- it "returns a String in the same encoding as the original" do
- str = "abc".force_encoding Encoding::IBM437
- result = str.ljust 5
- result.should == "abc "
- result.encoding.should equal(Encoding::IBM437)
- end
+ describe "with width" do
+ it "returns a String in the same encoding as the original" do
+ str = "abc".force_encoding Encoding::IBM437
+ result = str.ljust 5
+ result.should == "abc "
+ result.encoding.should equal(Encoding::IBM437)
+ end
+ end
+
+ describe "with width, pattern" do
+ it "returns a String in the compatible encoding" do
+ str = "abc".force_encoding Encoding::IBM437
+ result = str.ljust 5, "あ"
+ result.should == "abcああ"
+ result.encoding.should equal(Encoding::UTF_8)
end
- describe "with width, pattern" do
- it "returns a String in the compatible encoding" do
- str = "abc".force_encoding Encoding::IBM437
- result = str.ljust 5, "あ"
- result.should == "abcああ"
- result.encoding.should equal(Encoding::UTF_8)
- end
-
- it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
- pat = "ア".encode Encoding::EUC_JP
- lambda do
- "あれ".ljust 5, pat
- end.should raise_error(Encoding::CompatibilityError)
- end
+ it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
+ pat = "ア".encode Encoding::EUC_JP
+ lambda do
+ "あれ".ljust 5, pat
+ end.should raise_error(Encoding::CompatibilityError)
end
end
end