summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-09 14:33:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-09 14:33:11 +0000
commit62f7424640b0aff81834d3d310193ab9e1288bfb (patch)
tree1a3056244f47de1bf42299e5b308d8e551be628b /test
parent2ce1fbeb59dd0a125d56f2500b0dba1a56380da0 (diff)
erb.rb: safe concurrent use
* lib/erb.rb (ERB#run, ERB#result): eval under isolated bindings for safe concurrent use. [ruby-core:47638] [Bug #7046] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/erb/test_erb.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb
index 7ddbc87..686c404 100644
--- a/test/erb/test_erb.rb
+++ b/test/erb/test_erb.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
require 'test/unit'
require 'erb'
@@ -44,11 +45,20 @@ class TestERB < Test::Unit::TestCase
assert_equal("", ERB::Util.html_escape(""))
assert_equal("abc", ERB::Util.html_escape("abc"))
- assert_equal("&lt;&lt;", ERB::Util.html_escape("<<"))
+ assert_equal("&lt;&lt;", ERB::Util.html_escape("<\<"))
assert_equal("", ERB::Util.html_escape(nil))
assert_equal("123", ERB::Util.html_escape(123))
end
+
+ def test_concurrent_default_binding
+ template1 = 'one <%= ERB.new(template2).result %>'
+
+ eval 'template2 = "two"', TOPLEVEL_BINDING
+
+ bug7046 = '[ruby-core:47638]'
+ assert_equal("one two", ERB.new(template1).result, bug7046)
+ end
end
class TestERBCore < Test::Unit::TestCase