diff --git a/core/src/main/java/org/jruby/RubyString.java b/core/src/main/java/org/jruby/RubyString.java index bf311e6a16f..b1d91b0a151 100644 --- a/core/src/main/java/org/jruby/RubyString.java +++ b/core/src/main/java/org/jruby/RubyString.java @@ -7191,7 +7191,7 @@ public static IRubyObject includeRange(ThreadContext context, RubyString _beg, R (e = eByteList.get(0)) < 128 && (v = vByteList.get(0)) < 128) { if (b <= v && v < e) return context.tru; - if (!exclusive && v == e) return context.tru; + if (!exclusive && b <= v && v == e) return context.tru; return context.fals; } } diff --git a/test/mri/ruby/test_range.rb b/test/mri/ruby/test_range.rb index ff17dca69ee..7f097903d14 100644 --- a/test/mri/ruby/test_range.rb +++ b/test/mri/ruby/test_range.rb @@ -1034,6 +1034,11 @@ def test_include assert_include("a"..."z", "y") assert_not_include("a"..."z", "z") assert_not_include("a".."z", "cc") + assert_not_include("z".."a", "a") + assert_not_include("z".."a", "z") + assert_not_include("z".."a", "m") + assert_include("a".."a", "a") + assert_not_include("a"..."a", "a") assert_raise(TypeError) {("a"..).include?("c")} assert_raise(TypeError) {("a"..).include?("5")}