clash icon indicating copy to clipboard operation
clash copied to clipboard

Clash test does not work on Windows

Open maiertech opened this issue 10 years ago • 3 comments

I'm using Windows at work (unfortunately) and when I run bundle exec clash test, I get below stack trace. Double checked on Ubuntu and works fine there.

c:/tools/ruby215/lib/ruby/2.1.0/find.rb:42:in `block in find': No such file or directory (Errno::ENOENT)
        from c:/tools/ruby215/lib/ruby/2.1.0/find.rb:42:in `collect!'
        from c:/tools/ruby215/lib/ruby/2.1.0/find.rb:42:in `find'
        from c:/Users/User/Repositories/clash/lib/clash/diff.rb:64:in `each'
        from c:/Users/User/Repositories/clash/lib/clash/diff.rb:64:in `to_a'
        from c:/Users/User/Repositories/clash/lib/clash/diff.rb:64:in `dir_files'
        from c:/Users/User/Repositories/clash/lib/clash/diff.rb:51:in `mattching_dir_files'
        from c:/Users/User/Repositories/clash/lib/clash/diff.rb:40:in `diff_dirs'
        from c:/Users/User/Repositories/clash/lib/clash/diff.rb:17:in `diff'
        from c:/Users/User/Repositories/clash/lib/clash/test.rb:97:in `block in compare'
        from c:/Users/User/Repositories/clash/lib/clash/test.rb:93:in `each'
        from c:/Users/User/Repositories/clash/lib/clash/test.rb:93:in `compare'
        from c:/Users/User/Repositories/clash/lib/clash/test.rb:18:in `run'
        from c:/Users/User/Repositories/clash/lib/clash/tests.rb:64:in `run_test'
        from c:/Users/User/Repositories/clash/lib/clash/tests.rb:51:in `block (2 levels) in run'
        from c:/Users/User/Repositories/clash/lib/clash/tests.rb:47:in `each'
        from c:/Users/User/Repositories/clash/lib/clash/tests.rb:47:in `each_with_index'
        from c:/Users/User/Repositories/clash/lib/clash/tests.rb:47:in `block in run'
        from c:/Users/User/Repositories/clash/lib/clash/tests.rb:46:in `chdir'
        from c:/Users/User/Repositories/clash/lib/clash/tests.rb:46:in `run'
        from c:/Users/User/Repositories/clash/bin/clash:79:in `<top (required)>'
        from c:/tools/ruby215/lib/ruby/gems/2.1.0/bin/clash:23:in `load'
        from c:/tools/ruby215/lib/ruby/gems/2.1.0/bin/clash:23:in `<main>'

maiertech avatar Jan 21 '15 20:01 maiertech

Interesting. Thanks for the post. I wonder if Ruby's Find works differently there. I don't have a Windows machine to test this on, but I'll look at the code and see if there's anything weird I'm doing.

imathis avatar Jan 21 '15 20:01 imathis

This is what I see in the debugger: In diff.rb in diff_files I see a first call with _expected_output and then a second call with _output. But _output does not exist and that's why find.rb throws an exception. Here is the context:

  def find(*paths) # :yield: path
    block_given? or return enum_for(__method__, *paths)

    fs_encoding = Encoding.find("filesystem")

    require 'pry-byebug'
    binding.pry

    paths.collect!{|d| raise Errno::ENOENT unless File.exist?(d); d.dup}.each do |path|

with d being _output. I see on Ubuntu that after running the test, there is a _output that has been created.

I also saw that you create _output in test.rb, but if I set a break point in there at the beginning, it is not reached before the other error occurs.

maiertech avatar Jan 21 '15 21:01 maiertech

Fixed this issue in #18.

napuzba avatar Jun 06 '16 12:06 napuzba