Luis Lavena wrote:
On Wed, Dec 31, 2008 at 2:42 PM, Daniel Berger <[email protected]> wrote:
Hi,

This is from the latest git repo using Ruby 1.8.6-p114 on Solaris 10:

Started
...................................................................................................................................................................................................................................................................................................F...F.F.....................................................
Finished in 20.571438 seconds.

 1) Failure:
test_default_arguements_that_dont_match_names_are_ignored(TestTaskArguments)
[./test/test_task_arguments.rb:87]:
<nil> expected but was
<"cc">.

 2) Failure:
test_extra_names_are_nil(TestTaskArguments)
[./test/test_task_arguments.rb:50]:
<nil> expected but was
<"cc">.

 3) Failure:
test_named_args(TestTaskArguments) [./test/test_task_arguments.rb:40]:
<nil> expected but was
<"cc">.

351 tests, 964 assertions, 3 failures, 0 errors
rake aborted!
Command failed with status (1): [/usr/local/bin/ruby -w -Ilib
"/usr/local/l...]

I think I brought this up before, but people thought it was a Windows issue.
I think the problem is that I've got my CC environment variable set to "cc".

I'm not sure what's supposed to happen in that case, though.


Basically, Rake::TaskArguments is checking for cc being defined as
argument for a Task, and then fallback to ENV looking for it:

    def lookup(name)
      if @hash.has_key?(name)
        @hash[name]
      elsif ENV.has_key?(name.to_s)
        ENV[name.to_s]
      elsif ENV.has_key?(name.to_s.upcase)
        ENV[name.to_s.upcase]
      elsif @parent
        @parent.lookup(name)
      end
    end


So, let's say I have defined a task named foo, with a named argument
called cc and will default to ENV['CC'] if no CC is provided with the
task (rake foo[something-for-cc]

I believe that fallback on ENV is a non documented behavior of task arguments?

That's interesting, and not something I knew. A little surprising maybe even.

Anyway, if that's the correct behavior then the tests simply need to be updated.

Thanks,

Dan

_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel

Reply via email to