Closed thegengen closed 13 years ago
In Ruby 1.8, hash ordering is undefined. But in 1.9 hashes maintain the order in which keys were added. I guess on my 1.8 test run it came out the same. Good catch!
Yes, I think arrays would make for a better test. Patch away! I'll keep an eye out for pull requests.
On Fri, Jul 8, 2011 at 4:24 AM, minciue reply@reply.github.com wrote:
Hello again.
The test I patched fails on my machine, like so:
1) Failure: test_0003_pretty_prints_the_value(DSpec) [./test/d_test.rb:31]: Expected (output == "x is {:a=>\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n :b=>\"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"}\n"), but Strings differ at position 7: first: "x is {:b=>\"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"... second: "x is {:a=>\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"... output is "x is {:b=>\"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbb\",\n :a=>\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaa\"}\n"
I'm using ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.1], MBARI 0x6770, Ruby Enterprise Edition 2011.03 From what I know the order of a hash's elements isn't guaranteed by ruby. I wasn't really sure how to fix the test. Maybe you want to change the test to use arrays instead of a hash, or two hashes in an array? If you want me to do that instead, let me know and I will.
Eugen.
Reply to this email directly or view it on GitHub: https://github.com/sconover/wrong/pull/9
Alex Chaffee - alex@cohuman.com - http://alexch.github.com Stalk me: http://friendfeed.com/alexch | http://twitter.com/alexch | http://alexch.tumblr.com
I made it an array. Thanks anyway! https://github.com/sconover/wrong/commit/d1a64f3bd6a67b293fcef7ea9d2b4469b8edc9ab
Hello again.
The test I patched fails on my machine, like so:
I'm using ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.1], MBARI 0x6770, Ruby Enterprise Edition 2011.03 From what I know the order of a hash's elements isn't guaranteed by ruby. I wasn't really sure how to fix the test. Maybe you want to change the test to use arrays instead of a hash, or two hashes in an array? If you want me to do that instead, let me know and I will.
Eugen.