C0 code coverage information

Generated on Wed Oct 07 08:34:06 -0700 2009 with rcov 0.8.2.1


Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
Name Total lines Lines of code Total coverage Code coverage
lib/buildr/scala/bdd.rb 109 67
92.7%  
88.1%  
  1 # Licensed to the Apache Software Foundation (ASF) under one or more
  2 # contributor license agreements.  See the NOTICE file distributed with this
  3 # work for additional information regarding copyright ownership.  The ASF
  4 # licenses this file to you under the Apache License, Version 2.0 (the
  5 # "License"); you may not use this file except in compliance with the License.
  6 # You may obtain a copy of the License at
  7 #
  8 #    http://www.apache.org/licenses/LICENSE-2.0
  9 #
 10 # Unless required by applicable law or agreed to in writing, software
 11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 13 # License for the specific language governing permissions and limitations under
 14 # the License.
 15 
 16 
 17 require 'buildr/core/build'
 18 require 'buildr/core/compile'
 19 require 'buildr/java/bdd'
 20 require 'buildr/scala/tests'
 21 
 22 module Buildr::Scala
 23   
 24   # Specs is a Scala based BDD framework.
 25   # To use in your project:
 26   #
 27   #   test.using :specs
 28   # 
 29   # This framework will search in your project for:
 30   #   src/spec/scala/**/*.scala
 31   class Specs < Buildr::TestFramework::JavaBDD
 32     @lang = :scala
 33     @bdd_dir = :spec
 34 
 35     VERSION = '1.5.0'
 36     
 37     class << self
 38       def version
 39         Buildr.settings.build['scala.specs'] || VERSION
 40       end
 41       
 42       def dependencies
 43         ["org.scala-tools.testing:specs:jar:#{version}"] + Check.dependencies + JUnit.dependencies
 44       end
 45       
 46       def applies_to?(project)  #:nodoc:
 47         !Dir[project.path_to(:source, bdd_dir, lang, '**/*.scala')].empty?
 48       end
 49 
 50     private
 51       def const_missing(const)
 52         return super unless const == :REQUIRES # TODO: remove in 1.5
 53         Buildr.application.deprecated "Please use Scala::Specs.dependencies/.version instead of ScalaSpecs::REQUIRES/VERSION"
 54         dependencies
 55       end
 56     end
 57 
 58     def initialize(task, options) #:nodoc:
 59       super
 60       
 61       specs = task.project.path_to(:source, :spec, :scala)
 62       task.compile.from specs if File.directory?(specs)
 63       
 64       resources = task.project.path_to(:source, :spec, :resources)
 65       task.resources.from resources if File.directory?(resources)
 66     end
 67     
 68     def tests(dependencies)
 69       dependencies += [task.compile.target.to_s]
 70       candidates = filter_classes(dependencies, :interfaces => ['org.specs.Specification'])
 71       
 72       Java.load   # Java is already loaded, but just in case
 73       
 74       filter = Java.org.apache.buildr.JavaTestFilter.new(dependencies.to_java(Java.java.lang.String))
 75       filter.add_fields ['MODULE$'].to_java(Java.java.lang.String)
 76       filter.filter(candidates.to_java(Java.java.lang.String))      # we only want singletons
 77     end
 78     
 79     def run(specs, dependencies)  #:nodoc:
 80       dependencies += [task.compile.target.to_s, File.join(File.dirname(__FILE__))] + Scalac.dependencies
 81       
 82       cmd_options = { :properties => options[:properties],
 83                       :java_args => options[:java_args],
 84                       :classpath => dependencies}
 85 
 86       runner = 'org.apache.buildr.SpecsSingletonRunner'
 87       specs.inject [] do |passed, spec|
 88         begin
 89           unless Util.win_os?
 90             Java::Commands.java(runner, task.compile.target.to_s, '-c', spec, cmd_options)
 91           else
 92             Java::Commands.java(runner, task.compile.target.to_s, spec, cmd_options)
 93           end
 94         rescue => e
 95           passed
 96         else
 97           passed << spec
 98         end
 99       end
100     end
101   end
102 end
103 
104 # Backwards compatibility stuff.  Remove in 1.5.
105 module Buildr
106   ScalaSpecs = Scala::Specs
107 end
108 
109 Buildr::TestFramework << Buildr::Scala::Specs

Generated using the rcov code coverage analysis tool for Ruby version 0.8.2.1.

Valid XHTML 1.0! Valid CSS!