maik / xml-simple

Easy API for working with XML documents
MIT License
88 stars 27 forks source link

Failing testcase #17

Closed mrueg closed 9 years ago

mrueg commented 9 years ago

This testcase fails here:

Try parsing default external file (scriptname.xml in script directory)

opt = XmlSimple.xml_in(nil, { 'force_array' => false, 'key_attr' => %w(name key id) }) assert_equal({ 'location' => 'tc_perl_in.xml' }, opt)

1) Error: TC_Perl_In#test_perl_test_cases: ArgumentError: Could not find in </usr/lib64/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake> /var/tmp/portage/dev-ruby/xml-simple-1.1.5/work/ruby21/xml-simple-1.1.5/lib/xmlsimple.rb:998:in find_xml_file' /var/tmp/portage/dev-ruby/xml-simple-1.1.5/work/ruby21/xml-simple-1.1.5/lib/xmlsimple.rb:168:inxml_in' /var/tmp/portage/dev-ruby/xml-simple-1.1.5/work/ruby21/xml-simple-1.1.5/lib/xmlsimple.rb:203:in xml_in' /var/tmp/portage/dev-ruby/xml-simple-1.1.5/work/ruby21/xml-simple-1.1.5/test/tc_perl_in.rb:413:intest_perl_test_cases' /usr/lib64/ruby/2.1.0/minitest/unit.rb:1265:in run' /usr/lib64/ruby/2.1.0/test/unit/testcase.rb:17:inrun' /usr/lib64/ruby/2.1.0/minitest/unit.rb:940:in block in _run_suite' /usr/lib64/ruby/2.1.0/minitest/unit.rb:933:inmap' /usr/lib64/ruby/2.1.0/minitest/unit.rb:933:in _run_suite' /usr/lib64/ruby/2.1.0/test/unit.rb:663:inblock in _run_suites' /usr/lib64/ruby/2.1.0/test/unit.rb:661:in each' /usr/lib64/ruby/2.1.0/test/unit.rb:661:in_run_suites' /usr/lib64/ruby/2.1.0/minitest/unit.rb:884:in _run_anything' /usr/lib64/ruby/2.1.0/minitest/unit.rb:1092:inrun_tests' /usr/lib64/ruby/2.1.0/minitest/unit.rb:1079:in block in _run' /usr/lib64/ruby/2.1.0/minitest/unit.rb:1078:ineach' /usr/lib64/ruby/2.1.0/minitest/unit.rb:1078:in _run' /usr/lib64/ruby/2.1.0/minitest/unit.rb:1066:inrun' /usr/lib64/ruby/2.1.0/test/unit.rb:27:in run' /usr/lib64/ruby/2.1.0/test/unit.rb:780:inrun' /usr/lib64/ruby/2.1.0/test/unit.rb:372:in block (2 levels) in autorun' /usr/lib64/ruby/2.1.0/test/unit.rb:33:inrun_once' /usr/lib64/ruby/2.1.0/test/unit.rb:371:in `block in autorun'

Finished tests in 10.304425s, 3.6877 tests/s, 31.6369 assertions/s. 38 tests, 326 assertions, 0 failures, 1 errors, 0 skips

ruby -v: ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux] rake aborted! Command failed with status (1): [ruby -I"lib:./lib" -I"/usr/lib64/ruby/gems/2.1.0/gems/rake-10.4.2/lib" "/usr/lib64/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb" "test/tc_attr_prefix.rb" "test/tc_curtis.rb" "test/tc_file_in.rb" "test/tc_markup.rb" "test/tc_nick.rb" "test/tc_out.rb" "test/tc_perl_in.rb" "test/tc_perl_mem_copy.rb" "test/tc_perl_mem_share.rb" "test/tc_perl_out.rb" "test/tc_perl_storable.rb" "test/tc_string_in.rb" "test/tc_symbol.rb" ]

maik commented 9 years ago

Hi Manuel!

This one is a nasty one. The problem is that this test case checks, how xml_in behaves when you pass nil as the first argument. It should use the name of the script then, in this case tc_perl_in.xml. This works fine when you run the test directly from the test directory:

$ cd test $ ruby tc_perl_in.rb

When you run the test using rake, the script name changes to rake_test_loader and xml_in tries to find a file names rake_test_loader.xml which does not exist. I do not have a good idea how to change that.

Best, Maik

On Mon, Jan 26, 2015 at 8:59 PM, Manuel Rüger notifications@github.com wrote:

This testcase fails here:

Try parsing default external file (scriptname.xml in script directory)

opt = XmlSimple.xml_in(nil, { 'force_array' => false, 'key_attr' => %w(name key id) }) assert_equal({ 'location' => 'tc_perl_in.xml' }, opt)

1) Error: TC_Perl_In#test_perl_test_cases: ArgumentError: Could not find in /var/tmp/portage/dev-ruby/xml-simple-1.1.5/work/ruby21/xml-simple-1.1.5/lib/xmlsimple.rb:998:in find_xml_file'

/var/tmp/portage/dev-ruby/xml-simple-1.1.5/work/ruby21/xml-simple-1.1.5/lib/xmlsimple.rb:168:in xml_in' /var/tmp/portage/dev-ruby/xml-simple-1.1.5/work/ruby21/xml-simple-1.1.5/lib/xmlsimple.rb:203:in xml_in'

/var/tmp/portage/dev-ruby/xml-simple-1.1.5/work/ruby21/xml-simple-1.1.5/test/tc_perl_in.rb:413:in test_perl_test_cases' /usr/lib64/ruby/2.1.0/minitest/unit.rb:1265:in run' /usr/lib64/ruby/2.1.0/test/unit/testcase.rb:17:inrun' /usr/lib64/ruby/2.1.0/minitest/unit.rb:940:in block in _run_suite' /usr/lib64/ruby/2.1.0/minitest/unit.rb:933:inmap' /usr/lib64/ruby/2.1.0/minitest/unit.rb:933:in _run_suite' /usr/lib64/ruby/2.1.0/test/unit.rb:663:inblock in _run_suites' /usr/lib64/ruby/2.1.0/test/unit.rb:661:in each' /usr/lib64/ruby/2.1.0/test/unit.rb:661:in_run_suites' /usr/lib64/ruby/2.1.0/minitest/unit.rb:884:in _run_anything' /usr/lib64/ruby/2.1.0/minitest/unit.rb:1092:inrun_tests' /usr/lib64/ruby/2.1.0/minitest/unit.rb:1079:in block in _run' /usr/lib64/ruby/2.1.0/minitest/unit.rb:1078:ineach' /usr/lib64/ruby/2.1.0/minitest/unit.rb:1078:in _run' /usr/lib64/ruby/2.1.0/minitest/unit.rb:1066:inrun' /usr/lib64/ruby/2.1.0/test/unit.rb:27:in run' /usr/lib64/ruby/2.1.0/test/unit.rb:780:inrun' /usr/lib64/ruby/2.1.0/test/unit.rb:372:in block (2 levels) in autorun' /usr/lib64/ruby/2.1.0/test/unit.rb:33:inrun_once' /usr/lib64/ruby/2.1.0/test/unit.rb:371:in `block in autorun'

Finished tests in 10.304425s, 3.6877 tests/s, 31.6369 assertions/s. 38 tests, 326 assertions, 0 failures, 1 errors, 0 skips

ruby -v: ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux] rake aborted! Command failed with status (1): [ruby -I"lib:./lib" -I"/usr/lib64/ruby/gems/2.1.0/gems/rake-10.4.2/lib" "/usr/lib64/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb" "test/tc_attr_prefix.rb" "test/tc_curtis.rb" "test/tc_file_in.rb" "test/tc_markup.rb" "test/tc_nick.rb" "test/tc_out.rb" "test/tc_perl_in.rb" "test/tc_perl_mem_copy.rb" "test/tc_perl_mem_share.rb" "test/tc_perl_out.rb" "test/tc_perl_storable.rb" "test/tc_string_in.rb" "test/tc_symbol.rb" ]

— Reply to this email directly or view it on GitHub https://github.com/maik/xml-simple/issues/17.

Start simple or fail!

I am a software developer, hardware enthusiast, and a writer:

Follow me on Twitter: @maik_schmidt