Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112011-08-01T09:31:58ZRuby Issue Tracking System
Redmine Ruby master - Bug #5126 (Closed): Unicode character classes interpolated into regex throws exceptionhttps://bugs.ruby-lang.org/issues/51262011-08-01T09:31:58Zxaviershay (Xavier Shay)xavier-list@rhnh.net
<p>The following script runs under 1.9.2-p290:</p>
<pre><code># encoding: UTF-8
letter = '\p{L}'
atext = "[#{letter}]"
/#{atext}/
</code></pre>
<p>Under 1.9.3-preview1 it raises an exception:</p>
<pre><code>test.rb:6:in `<main>': invalid character property name {L}: /[\p{L}]/ (RegexpError)
</code></pre>
<p>The interpolation is necessary to reproduce this bug, unicode character classes work fine when entered directly into the regex.</p>
<p>JRuby has a similar bug: <a href="http://jira.codehaus.org/browse/JRUBY-5622" class="external">http://jira.codehaus.org/browse/JRUBY-5622</a></p>
<p>This technique is used in datamapper to build a regex for matching emails:<br>
<a href="https://github.com/datamapper/dm-validations/blob/master/lib/dm-validations/formats/email.rb" class="external">https://github.com/datamapper/dm-validations/blob/master/lib/dm-validations/formats/email.rb</a></p> Ruby master - Feature #4796 (Closed): Coverage should be restartablehttps://bugs.ruby-lang.org/issues/47962011-05-29T12:41:54Zxaviershay (Xavier Shay)xavier-list@rhnh.net
<p>I would like a way to be able to make the following test past:</p>
<pre><code>require "test/unit"
require "coverage"
require 'tmpdir'
class TestCoverage < Test::Unit::TestCase
def test_restarting_coverage
Dir.mktmpdir {|tmp|
Dir.chdir(tmp) {
File.open("test.rb", "w") do |f|
f.puts <<-EOS
def coverage_test_method
puts :ok
end
EOS
end
Coverage.start
require tmp + '/test.rb'
Coverage.result
Coverage.start
coverage_test_method
assert_equal 1, Coverage.result.size
}
}
end
end
</code></pre>
<p>The problem is that <code>Coverage.start</code> doesn't track any files loaded before it is called. This is probably desired behaviour so that stdlib files are not tracked, but it limits the usefulness of Coverage. Specifically, I am trying to collate coverage reports from workers in multiple processes. Also I want to associate coverages with specific tests (this test executed this code, etc...). This is very difficult without being able to restart.</p>
<p>What would be involved in doing this? If you point me in the right direction I can perhaps have a go.</p>