Skip to content

Instantly share code, notes, and snippets.

@mvidner
Created February 3, 2016 15:07
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 mvidner/d1c803083dd6b156fb7b to your computer and use it in GitHub Desktop.
Save mvidner/d1c803083dd6b156fb7b to your computer and use it in GitHub Desktop.
generate a file that will not parse with parser-2.3.0.2
#!/usr/bin/ruby
# parser-2.3.0.2 fails with fatal: unterminated string meets end of file
# ruby makebigfile.rb && ruby bigfile.rb && bundle exec ruby-parse --23 bigfile.rb
SIZE = 14500
header = <<EOS
#!/usr/bin/ruby
# encoding: utf-8
# stub
def recursive(*args)
args
end
puts 'A big widget tree (#{SIZE})'
recursive(
[
EOS
body = <<EOS
recursive(recursive("foo"), recursive(:bar, "baz"), "qux"),
EOS
footer = <<EOS
]
)
puts "Done"
EOS
File.write("bigfile.rb", header + body * SIZE + footer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment