Skip to content

Instantly share code, notes, and snippets.

@yaotti
Created August 16, 2013 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaotti/6251454 to your computer and use it in GitHub Desktop.
Save yaotti/6251454 to your computer and use it in GitHub Desktop.
These code cause SEGV in ruby 2.1.0-dev but the bug is already fixed in ruby-head (I tested it in ff377d9e81e9c0e58ba1034b1b58cfb68d63c301).
#!/usr/bin/env ruby
def let(name, &block)
::BasicObject.send(:define_method, name, &block)
define_method(name) do
super(&nil)
end
end
let(:foo) { foo }
foo
require 'rspec'
describe Object do
let(:foo) { foo }
it 'causes segv' do
foo
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment