[macruby-changes] [4761] DietRB/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Oct 8 04:10:59 PDT 2010
Revision: 4761
http://trac.macosforge.org/projects/ruby/changeset/4761
Author: eloy.de.enige at gmail.com
Date: 2010-10-08 04:10:58 -0700 (Fri, 08 Oct 2010)
Log Message:
-----------
Edge case, handle backspace characters
From: Eloy Duran <eloy.de.enige at gmail.com>
Modified Paths:
--------------
DietRB/trunk/lib/irb/source.rb
DietRB/trunk/spec/source_spec.rb
Modified: DietRB/trunk/lib/irb/source.rb
===================================================================
--- DietRB/trunk/lib/irb/source.rb 2010-10-08 11:10:49 UTC (rev 4760)
+++ DietRB/trunk/lib/irb/source.rb 2010-10-08 11:10:58 UTC (rev 4761)
@@ -191,7 +191,7 @@
end
def on_tstring_end(token)
- if tokens_match?(@in_string, token)
+ if @in_string && tokens_match?(@in_string, token)
@in_string = nil
@level -= 1
end
Modified: DietRB/trunk/spec/source_spec.rb
===================================================================
--- DietRB/trunk/spec/source_spec.rb 2010-10-08 11:10:49 UTC (rev 4760)
+++ DietRB/trunk/spec/source_spec.rb 2010-10-08 11:10:58 UTC (rev 4761)
@@ -191,12 +191,18 @@
["{ :foo => ", " :bar }"],
["[ 1", ", 2 ]"],
+ ["'", "'"],
+ ["' ", " '"],
["'foo ", " bar'"],
["' foo ", " bar '"],
+ ['"', '"'],
+ ['" ', ' "'],
['"foo ', ' bar"'],
['" foo ', ' bar "'],
+ ["%{", "}"],
+ ["%{ ", " }"],
["%{foo ", " bar}"],
["%{ foo ", " bar }"],
["%(foo ", " bar)"],
@@ -204,6 +210,7 @@
["%[ foo ", " bar ]"],
["%[foo ", " bar]"],
+ ["%w{ ", " }"],
["%w{foo ", " bar}"],
["%w{ foo ", " bar }"],
["%w(foo ", " bar)"],
@@ -234,4 +241,15 @@
reflect("#{open}\n#{close}").code_block?.should == true
end
end
+
+ it "handles cases that contain backspaces" do
+ [
+ ["%{", "\b"],
+ ["%w{", "\b"],
+ ["%r{", "\b"],
+ ].each do |open, close|
+ reflect("#{open}\n#{close}").level.should == 1
+ reflect("#{open}\n#{close}").code_block?.should == false
+ end
+ end
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101008/fd66368a/attachment-0001.html>
More information about the macruby-changes
mailing list