summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-28 01:26:37 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-28 01:26:37 +0000
commitc7c263eefc2509df20206763f05383009961d68c (patch)
treecc68e9671fcd2cf3353c1daa4b17b31562bcbbb6 /test
parent73e3ea958d625379b8df8af2c6efb4e903338470 (diff)
* test/ruby/test_m17n.rb (test_magic_comment): add test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_m17n.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index 4cf79d0037..c503cdbea3 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -1027,4 +1027,11 @@ class TestM17N < Test::Unit::TestCase
t = r.source
assert_equal(s, t, "[ruby-dev:33377] Regexp.new(#{encdump s}).source")
end
+
+ def test_magic_comment
+ assert_equal(Encoding::US_ASCII, eval("__ENCODING__".force_encoding("US-ASCII")))
+ assert_equal(Encoding::ASCII_8BIT, eval("__ENCODING__".force_encoding("ASCII-8BIT")))
+ assert_equal(Encoding::US_ASCII, eval("# -*- encoding: US-ASCII -*-\n__ENCODING__".force_encoding("ASCII-8BIT")))
+ assert_equal(Encoding::ASCII_8BIT, eval("# -*- encoding: ASCII-8BIT -*-\n__ENCODING__".force_encoding("US-ASCII")))
+ end
end