Sha256: 5ac905b7d54a579cc6c2adbbd2ca58bca814447b00fc22014bc48f00f4700469

Contents?: true

Size: 1.65 KB

Versions: 14

Compression:

Stored size: 1.65 KB

Contents

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with this
# work for additional information regarding copyright ownership.  The ASF
# licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
# License for the specific language governing permissions and limitations under
# the License.

require 'yaml'

module Buildr #:nodoc:
  module TestFramework #:nodoc:

    # A class used by buildr for jruby based frameworks, so that buildr can know
    # which tests succeeded/failed.
    class TestResult

      class Error < ::Exception
        attr_reader :message, :backtrace
        def initialize(message, backtrace)
          @message = message
          @backtrace = backtrace
          set_backtrace backtrace
        end

        def self.dump_yaml(file, e)
          FileUtils.mkdir_p File.dirname(file)
          File.open(file, 'w') { |f| f.puts(YAML.dump(Error.new(e.message, e.backtrace))) }
        end

        def self.guard(file)
          begin
            yield
          rescue => e
            dump_yaml(file, e)
          end
        end
      end

      attr_accessor :failed, :succeeded

      def initialize
        @failed, @succeeded = [], []
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
realityforge-buildr-1.5.22 lib/buildr/java/test_result.rb
realityforge-buildr-1.5.21 lib/buildr/java/test_result.rb
realityforge-buildr-1.5.20 lib/buildr/java/test_result.rb
realityforge-buildr-1.5.19 lib/buildr/java/test_result.rb
realityforge-buildr-1.5.18 lib/buildr/java/test_result.rb
realityforge-buildr-1.5.17 lib/buildr/java/test_result.rb
realityforge-buildr-1.5.16 lib/buildr/java/test_result.rb
realityforge-buildr-1.5.15 lib/buildr/java/test_result.rb
realityforge-buildr-1.5.14 lib/buildr/java/test_result.rb
realityforge-buildr-1.5.13 lib/buildr/java/test_result.rb
realityforge-buildr-1.5.12 lib/buildr/java/test_result.rb
realityforge-buildr-1.5.11 lib/buildr/java/test_result.rb
realityforge-buildr-1.5.10 lib/buildr/java/test_result.rb
realityforge-buildr-1.5.9 lib/buildr/java/test_result.rb