lib/tst-reg-test.rb in regextest-0.1.6 vs lib/tst-reg-test.rb in regextest-0.1.8
- old
+ new
@@ -87,11 +87,11 @@
next if(i < min_test || i > max_test)
puts line
reg = line.gsub(/^\s*(?:x1|x2|n)\(\"|\"\)\s*$/, "")
begin
rc = nil
- timeout(timeout_seconds){
+ Timeout.timeout(timeout_seconds){
rc = eval(line)
}
if(rc[:result] == :ok)
results[:success].push({ md: rc[:md], reg: rc[:reg], index: i})
else
@@ -142,9 +142,10 @@
f.each do |line|
line.force_encoding("utf-8")
if !line.match(/ONIG_SYNTAX_PERL/)
if(md = line.match(/^\s*(?:x|x2|n)\s*\(.+?$/u) rescue nil)
line.sub!(/,\s*\".+?$/, ")") rescue nil
+ line.gsub!(/\\\\x\{(\h+)\}/) { "\\u{#{$1}}" }
lines.push line if line
end
else
warn "Perl syntax. \nline:#{line}"
results[:perl_syntax].push({ type: :perl_syntax, test: line, info: nil, index: perl_index})