Martin Kleppmann created AVRO-1516:
--------------------------------------
Summary: Unit test failure in Ruby 2.0 and above
Key: AVRO-1516
URL: https://issues.apache.org/jira/browse/AVRO-1516
Project: Avro
Issue Type: Test
Components: ruby
Affects Versions: 1.7.6
Reporter: Martin Kleppmann
The following unit test fails when run with Ruby 2.0 and above:
{noformat}
$ bundle exec rake test
/Users/mkleppma/.rubies/ruby-2.0.0-p195/bin/ruby -I"lib:ext:bin:test"
-I"/Users/mkleppma/.gem/ruby/2.0.0/gems/rake-10.3.1/lib"
"/Users/mkleppma/.gem/ruby/2.0.0/gems/rake-10.3.1/lib/rake/rake_test_loader.rb"
"test/test_datafile.rb" "test/test_help.rb" "test/test_io.rb"
"test/test_protocol.rb" "test/test_schema.rb" "test/test_socket_transport.rb"
Run options:
# Running tests:
[30/41] TestIO#test_union = 0.00 s
1) Failure:
test_union(TestIO)
[/Users/mkleppma/Applications/avro/lang/ruby/test/test_io.rb:339]:
<-3372032630846393039> expected but was
<-3.372032630846393e+18>.
Finished tests in 0.346139s, 118.4495 tests/s, 2207.2058 assertions/s.
41 tests, 764 assertions, 1 failures, 0 errors, 0 skips
ruby -v: ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0]
rake aborted!
Command failed with status (1): [ruby -I"lib:ext:bin:test"
-I"/Users/mkleppma/.gem/ruby/2.0.0/gems/rake-10.3.1/lib"
"/Users/mkleppma/.gem/ruby/2.0.0/gems/rake-10.3.1/lib/rake/rake_test_loader.rb"
"test/test_datafile.rb" "test/test_help.rb" "test/test_io.rb"
"test/test_protocol.rb" "test/test_schema.rb" "test/test_socket_transport.rb" ]
/Users/mkleppma/.gem/ruby/2.0.0/gems/echoe-4.6.5/lib/echoe.rb:749:in `block in
define_tasks'
Tasks: TOP => test_inner
(See full trace by running task with --trace)
{noformat}
Brief investigation suggests that this isn't a bug in Avro, but just a badly
written test. The test is comparing -3372032630846393039 and
-3372032630846393000.0, which Ruby 1.9 and below consider to be equal, but Ruby
2.0 and above consider to be non-equal.
Our tests shouldn't be relying on such edge cases of type coercion.
--
This message was sent by Atlassian JIRA
(v6.2#6252)