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
Thu May 15 21:04:30 2014 Wayne Conrad <wconrad@yagni.com>
* re.c (rb_reg_to_regexp): Regexp#to_regexp [Feature #9846]
Thu May 15 18:57:23 2014 Koichi Sasada <ko1@atdot.net>
* gc.c (garbage_collect_body): move gc_heap_prepare_minimum_pages()
re.c
}
VALUE
rb_reg_to_regexp(VALUE re)
{
return rb_convert_type(re, T_REGEXP, "Regexp", "to_regexp");
}
VALUE
rb_check_regexp_type(VALUE re)
{
return rb_check_convert_type(re, T_REGEXP, "Regexp", "to_regexp");
......
rb_define_method(rb_cRegexp, "fixed_encoding?", rb_reg_fixed_encoding_p, 0);
rb_define_method(rb_cRegexp, "names", rb_reg_names, 0);
rb_define_method(rb_cRegexp, "named_captures", rb_reg_named_captures, 0);
rb_define_method(rb_cRegexp, "to_regexp", rb_reg_to_regexp, 0);
/* see Regexp.options and Regexp.new */
rb_define_const(rb_cRegexp, "IGNORECASE", INT2FIX(ONIG_OPTION_IGNORECASE));
test/ruby/test_regexp.rb
RUBY
end
def test_to_regexp
re = //
assert_same(re, re.to_regexp)
end
# This assertion is for porting x2() tests in testpy.py of Onigmo.
def assert_match_at(re, str, positions, msg = nil)
re = Regexp.new(re) unless re.is_a?(Regexp)
    (1-1/1)