berkesokhan / rubydotnetcompiler

Automatically exported from code.google.com/p/rubydotnetcompiler
1 stars 0 forks source link

MatchData#to_a: failed optional match should produce nil, not empty string #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Testcase:

  'a' =~ /(a)|(b)/
  puts $~.to_a[2].inspect

  'a' =~ /(a)(b)?/
  puts $~.to_a[2].inspect

Expected:

  nil
  nil

Actual:

  ""
  ""

First reported by Seo Sanghyeon in #ruby.net.

Original issue reported on code.google.com by sason...@gmail.com on 12 Sep 2007 at 12:18

GoogleCodeExporter commented 9 years ago
Fix attached.

Original comment by sason...@gmail.com on 12 Sep 2007 at 12:29

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in r93.

Original comment by sason...@gmail.com on 15 Sep 2007 at 1:03