brianmario / fast_xs

excessively fast escaping
MIT License
28 stars 6 forks source link

Ruby 1.9 test fix #2

Open Flameeyes opened 12 years ago

brianmario commented 12 years ago

Is the encoding coming back in these assertions always Encoding::ASCII_8BIT? We don't need to check for Ruby 1.9 because that test will only be run on 1.9 anyway (see here). I think the real issue is that there's a bug in that the ASCII_8BIT (binary) encoding is being returned in every case?

Flameeyes commented 12 years ago

Obviously you're right, that's not the problem :/ I somehow assumed Encoding was present (and misimplemented) on 1.8 as well, but no, it's definitely missing.. checking now what's up.

Flameeyes commented 12 years ago

Uuuuuh this gets interesting: all works fine if I run ruby19 -Ilib:test test/test_erb_util_module_override.rb but fails if I run it through rake...

Flameeyes commented 12 years ago

And same happens if I run it through testrb ...

brianmario commented 12 years ago

what about if you do ruby19 rake ... ?

Flameeyes commented 12 years ago

Ha! I know why! The problem is the way the require lines happen when running via rake (hoe) or testrb.

Ruby will not reload fast_xs_monkey_patching when it's included at the top of test_erb_util_module_overrides.rb, but will include erb at that point, making it non-override...

A quick and dirty solution would be to rename test_*.rb to tc_*.rb and add a test_all.rb entry that creates a testsuite to run the others (I have the code to do that)...

Flameeyes commented 12 years ago

(When I said rake before I meant ruby19 -S rake of course, otherwise I would be running it with ruby18 actually. But see the latest comment for the solution ;))