From 7eafeaa31328b4074761f4b33dc2b89946fb0617 Mon Sep 17 00:00:00 2001 From: charliesome Date: Thu, 5 Sep 2013 09:07:48 +0000 Subject: * string.c (fstring_cmp): take string encoding into account when comparing fstrings [ruby-core:57037] [Bug #8866] * test/ruby/test_string.rb: add test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_string.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 1387feccf5..4520464105 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -2249,6 +2249,13 @@ class TestString < Test::Unit::TestCase b = "hello"f assert_equal a.object_id, b.object_id end + + def test_frozen_strings_are_deduplicated_with_encoding + a = eval("# coding: utf-8\n'hello'f") + b = eval("# coding: ascii\n'hello'f") + assert_equal Encoding::UTF_8, a.encoding + assert_equal Encoding::US_ASCII, b.encoding + end end class TestString2 < TestString -- cgit v1.2.3