diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | lib/erb.rb | 10 | ||||
-rw-r--r-- | test/erb/test_erb.rb | 10 |
3 files changed, 20 insertions, 9 deletions
@@ -1,3 +1,12 @@ +Mon Jun 2 16:08:24 2008 Akinori MUSHA <knu@iDaemons.org> + + * lib/erb.rb (ERB::Compiler::TrimScanner#scan_line): Fix a bug + where tokens are not yilelded one by one. + + * test/erb/test_erb.rb (TestERBCore#_test_01) + (TestERBCore#test_02_safe_04): The expected value should come + first for assert_equal(). + Mon Jun 2 13:06:38 2008 NAKAMURA Usaku <usa@ruby-lang.org> * mkconfig.rb: hide build path from rbconfig.rb. diff --git a/lib/erb.rb b/lib/erb.rb index fade2c72ba..58f98ca00f 100644 --- a/lib/erb.rb +++ b/lib/erb.rb @@ -329,15 +329,17 @@ class ERB end def scan_line(line) - line.split(SplitRegexp).each do |token| - next if token.empty? - yield(token) + line.split(SplitRegexp).each do |tokens| + tokens.each do |token| + next if token.empty? + yield(token) + end end end def trim_line1(line) line.split(TrimSplitRegexp).each do |token| - next if token.empty? + next if token.empty? if token == "%>\n" yield('%>') yield(:cr) diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb index aac33863d4..ccd3ddb9fc 100644 --- a/test/erb/test_erb.rb +++ b/test/erb/test_erb.rb @@ -54,16 +54,16 @@ class TestERBCore < Test::Unit::TestCase def _test_core(safe) erb = @erb.new("hello") - assert_equal(erb.result, "hello") + assert_equal("hello", erb.result) erb = @erb.new("hello", safe, 0) - assert_equal(erb.result, "hello") + assert_equal("hello", erb.result) erb = @erb.new("hello", safe, 1) - assert_equal(erb.result, "hello") + assert_equal("hello", erb.result) erb = @erb.new("hello", safe, 2) - assert_equal(erb.result, "hello") + assert_equal("hello", erb.result) src = <<EOS %% hi @@ -159,7 +159,7 @@ EOS def test_safe_04 erb = @erb.new('<%=$SAFE%>', 4) - assert_equal(erb.result(TOPLEVEL_BINDING.taint), '4') + assert_equal('4', erb.result(TOPLEVEL_BINDING.taint)) end class Foo; end |