[Rake-devel] Test failures on Solaris 10

Luis Lavena luislavena at gmail.com
Wed Dec 31 19:11:08 EST 2008


On Wed, Dec 31, 2008 at 2:42 PM, Daniel Berger <Daniel.Berger at qwest.com> 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?

-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry


More information about the Rake-devel mailing list