summaryrefslogtreecommitdiff
path: root/test/ruby/test_const.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_const.rb')
-rw-r--r--test/ruby/test_const.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/ruby/test_const.rb b/test/ruby/test_const.rb
index 8b3acfb683..417cc7c961 100644
--- a/test/ruby/test_const.rb
+++ b/test/ruby/test_const.rb
@@ -49,11 +49,15 @@ class TestConst < Test::Unit::TestCase
def test_redefinition
c = Class.new
- c.const_set(:X, 1)
- assert_output(nil, <<-WARNING) {c.const_set(:X, 2)}
-#{__FILE__}:#{__LINE__-1}: warning: already initialized constant #{c}::X
-#{__FILE__}:#{__LINE__-3}: warning: previous definition of X was here
+ name = "X\u{5b9a 6570}"
+ c.const_set(name, 1)
+ prev_line = __LINE__ - 1
+ EnvUtil.with_default_internal(Encoding::UTF_8) do
+ assert_output(nil, <<-WARNING) {c.const_set(name, 2)}
+#{__FILE__}:#{__LINE__-1}: warning: already initialized constant #{c}::#{name}
+#{__FILE__}:#{prev_line}: warning: previous definition of #{name} was here
WARNING
+ end
code = <<-PRE
olderr = $stderr.dup
$stderr.reopen(File::NULL, "wb")