Project

General

Profile

Feature #9846 ยป 0001-re.c-rb_reg_to_regexp-add-to_regexp.patch

wconrad (Wayne Conrad), 05/16/2014 12:31 PM

View differences:

ChangeLog
1
Thu May 15 21:04:30 2014  Wayne Conrad  <wconrad@yagni.com>
2

  
3
	* re.c (rb_reg_to_regexp): Regexp#to_regexp [Feature #9846]
4

  
1 5
Thu May 15 18:57:23 2014  Koichi Sasada  <ko1@atdot.net>
2 6

  
3 7
	* gc.c (garbage_collect_body): move gc_heap_prepare_minimum_pages()
re.c
3165 3165
}
3166 3166

  
3167 3167
VALUE
3168
rb_reg_to_regexp(VALUE re)
3169
{
3170
  return rb_convert_type(re, T_REGEXP, "Regexp", "to_regexp");
3171
}
3172

  
3173
VALUE
3168 3174
rb_check_regexp_type(VALUE re)
3169 3175
{
3170 3176
    return rb_check_convert_type(re, T_REGEXP, "Regexp", "to_regexp");
......
3641 3647
    rb_define_method(rb_cRegexp, "fixed_encoding?", rb_reg_fixed_encoding_p, 0);
3642 3648
    rb_define_method(rb_cRegexp, "names", rb_reg_names, 0);
3643 3649
    rb_define_method(rb_cRegexp, "named_captures", rb_reg_named_captures, 0);
3650
    rb_define_method(rb_cRegexp, "to_regexp", rb_reg_to_regexp, 0);
3644 3651

  
3645 3652
    /* see Regexp.options and Regexp.new */
3646 3653
    rb_define_const(rb_cRegexp, "IGNORECASE", INT2FIX(ONIG_OPTION_IGNORECASE));
test/ruby/test_regexp.rb
1028 1028
    RUBY
1029 1029
  end
1030 1030

  
1031
  def test_to_regexp
1032
    re = //
1033
    assert_same(re, re.to_regexp)
1034
  end
1035

  
1031 1036
  # This assertion is for porting x2() tests in testpy.py of Onigmo.
1032 1037
  def assert_match_at(re, str, positions, msg = nil)
1033 1038
    re = Regexp.new(re) unless re.is_a?(Regexp)
1034
-