[macruby-changes] [MacRuby/MacRuby] c49536: MatchData#string will return same class as origina...

noreply at github.com noreply at github.com
Fri Apr 22 09:00:15 PDT 2011


Branch: refs/heads/master
Home:   https://github.com/MacRuby/MacRuby

Commit: c49536f8153d663344a8240e58f87cd572871aa2
    https://github.com/MacRuby/MacRuby/commit/c49536f8153d663344a8240e58f87cd572871aa2
Author: Watson <watson1978 at gmail.com>
Date:   2011-04-22 (Fri, 22 Apr 2011)

Changed paths:
  M re.c

Log Message:
-----------
MatchData#string will return same class as original string. and will copy status of taint/untrust from original string.

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

class SubStr < String
  def value
    "value : " + self
  end
end

str = SubStr.new("hello\n world")
str.untrust
str.taint
s = str.match(/world/)
p s.string.value
assert_equal(SubStr, s.string.class)
assert_equal(true, s.string.tainted?)
assert_equal(true, s.string.untrusted?)

puts :ok
}}}




More information about the macruby-changes mailing list