summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/ord_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/ord_spec.rb')
-rw-r--r--spec/ruby/core/string/ord_spec.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/ruby/core/string/ord_spec.rb b/spec/ruby/core/string/ord_spec.rb
index cfc630a124..35af3b5458 100644
--- a/spec/ruby/core/string/ord_spec.rb
+++ b/spec/ruby/core/string/ord_spec.rb
@@ -25,4 +25,9 @@ describe "String#ord" do
it "raises an ArgumentError if called on an empty String" do
-> { ''.ord }.should raise_error(ArgumentError)
end
+
+ it "raises ArgumentError if the character is broken" do
+ s = "©".dup.force_encoding("US-ASCII")
+ -> { s.ord }.should raise_error(ArgumentError, "invalid byte sequence in US-ASCII")
+ end
end