sconover / wrong

Wrong provides a general assert method that takes a predicate block. Assertion failure messages are rich in detail.
MIT License
434 stars 31 forks source link

upgrading Wrong to use Ryan's new versions of ruby_parser and ruby2ruby #23

Closed alexch closed 11 years ago

alexch commented 12 years ago

This will remove the ParseTree (and maybe RubyInline?) dependencies, as well as allow Ruby 1.9 syntax to be used inside Wrong assert blocks.

We can't release it quite yet because (a) they're not released yet (except in alpha) and (b) there's a bug in ruby_parser that conflicts with the "d" method - https://github.com/seattlerb/ruby_parser/pull/59

Most of the work is done though; checked in to my fork as dbb95a9

zenspider commented 12 years ago

Is this even going to work for wrong??? (that sounds wierd in my head). I thought you used ParseTree for the ability to grab the sexp of a block. RP doesn't have that capability at all (and can't).

Confirmed that this will also remove your dependency on RubyInline.

zenspider commented 12 years ago

As an aside, I think you can remove the process_hash monkeypatch... please test to make sure tho. As far as this goes:

I tried to fork r2r and add a test, but a lot of other tests

broke, and I just dont understand the test in ruby2ruby.

If you can remember, please let me know what was confusing / broken / strange and I'll try to at least explain, if not make it better in the code.

zenspider commented 12 years ago

Another aside, Sexp has #deep_each which may be able to replace #each_subexp. I don't have the ability to exclude the root node, so you may want to pass that back upstream.

virgoproz commented 11 years ago

Since ruby2ruby released a new version. I get this as well while running "bundle outdated" or "bundle update":

Bundler could not find compatible versions for gem "ruby2ruby": In Gemfile: wrong (>= 0.6.2) ruby depends on ruby2ruby (~> 1.2) ruby

wrong (>= 0.6.2) ruby depends on
  ruby2ruby (2.0.1)
zelig commented 11 years ago

Using erector with ruby 1.9.3 on latest rails https://github.com/pivotal/erector/pull/36, I needed to fix wrong to resolve version conflicts. changing in the Gemfile

s.add_dependency "ruby_parser", ">= 3.0.1"
s.add_dependency "ruby2ruby", ">= 2.0.1"
s.add_dependency "sexp_processor", ">= 4.0"

solved the problem and all seemed to work well. Surely I don't know if wrong is fully compatible with these higher versions, but if it is, I would like to see this reflected in lifted '~>' maximum-version specification on these gems. let me know, thx

alexch commented 11 years ago

Awesome. I've been procrastinating fixing this.

The one other issue is to remove "sourcify" and make sure everything really works with only Ryan's stuff.

(And of course, Ruby 2.0 is on the horizon.)

On Sun, Nov 11, 2012 at 2:49 AM, Viktor Tron notifications@github.comwrote:

Using erector with ruby 1.9.3 on latest rails pivotal/erector#36https://github.com/pivotal/erector/issues/36, I needed to fix wrong to resolve version conflicts. changing in the Gemfile

s.add_dependency "ruby_parser", ">= 3.0.1" s.add_dependency "ruby2ruby", ">= 2.0.1" s.add_dependency "sexp_processor", ">= 4.0"

solved the problem and all seemed to work well. Surely I don't know if wrong is fully compatible with these higher versions, but if it is, I would like to see this reflected in lifted '~>' maximum-version specification on these gems. let me know, thx

— Reply to this email directly or view it on GitHubhttps://github.com/sconover/wrong/issues/23#issuecomment-10265119.

Alex Chaffee - alex@stinky.com http://alexchaffee.com http://twitter.com/alexch

alexch commented 11 years ago

I still need to deal with Ryan's specific suggestions, but I just used @zelig 's patch and it seems to work ok, so I released a new version because lots of people were getting version conflicts with 0.6.2 see 29d5b22

alexch commented 11 years ago

d4cdd9da0454b0ce71470aca8daa24ca2256b82d finishes ripping out Sourcify and ParseTree. I still need to test it on as many Rubies as I can (including maybe 2.0?) before another release.

@zenspider, I use a heinous-- uh, I mean elegant hack to grab just enough lines that are parsable at or before the assertion -- see https://github.com/alexch/wrong/blob/master/lib/wrong/chunk.rb#L71-L95

I don't know about @sconover's process_hash monkeypatch but I removed that whole file and all the tests pass so...

zenspider commented 11 years ago

newest ruby_parser isn't too loud.

alexch commented 11 years ago

newest ruby_parser isn't too loud for what?

zenspider commented 11 years ago

https://github.com/alexch/wrong/blob/master/lib/wrong/chunk.rb#L86

alexch commented 11 years ago

Ah yes. Well without that "capturing" line, RubyParser spews out hundreds of lines like

# ERROR: (string):1 :: parse error on value "}" (tRCURLY)

so, too loud for us.

zenspider commented 11 years ago

On Nov 17, 2012, at 08:45 , Alex Chaffee notifications@github.com wrote:

Ah yes. Well without that "capturing" line, RubyParser spews out hundreds of lines like

ERROR: (string):1 :: parse error on value "}" (tRCURLY)

so, too loud for us.

Holy crap. I haven't released in 15 days! Update and you'll be happier.