Skip to content

Instantly share code, notes, and snippets.

@Watson1978
Created April 19, 2012 13:53
Show Gist options
  • Select an option

  • Save Watson1978/2421095 to your computer and use it in GitHub Desktop.

Select an option

Save Watson1978/2421095 to your computer and use it in GitHub Desktop.
MacRuby : bug : regexp

Expect

$ ruby19  -e 'Regexp.allocate.to_s'
-e:1:in `to_s': uninitialized Regexp (TypeError)
	from -e:1:in `<main>'

Result

$ macruby -e 'Regexp.allocate.to_s'
Assertion failed: (RREGEXP(re)->pattern != NULL), function rb_reg_options, file re.c, line 1228.
zsh: abort      macruby -e 'Regexp.allocate.to_s'
require 'test/unit/assertions.rb'
include Test::Unit::Assertions
assert_raises(TypeError){ Regexp.allocate.hash }
assert_raises(TypeError){ Regexp.allocate.eql? Regexp.new('') }
assert_raises(TypeError){ Regexp.new('').eql? Regexp.allocate }
assert_raises(TypeError){ Regexp.allocate == Regexp.new('') }
assert_raises(TypeError){ Regexp.new('') == Regexp.allocate }
assert_raises(TypeError){ Regexp.allocate =~ "foo" }
assert_raises(TypeError){ Regexp.allocate === "foo" }
assert_raises(TypeError){ Regexp.allocate.match "foo" }
assert_raises(TypeError){ Regexp.allocate.to_s }
assert_raises(TypeError){ Regexp.allocate.source }
assert_raises(TypeError){ Regexp.allocate.casefold? }
assert_raises(TypeError){ Regexp.allocate.names }
assert_raises(TypeError){ Regexp.allocate.named_captures }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment