Sha256: c3222dfb0f2e872940b96ed402d29ef64de5e021c8a738cea8ce2d27dae3e7ac

Contents?: true

Size: 709 Bytes

Versions: 14

Compression:

Stored size: 709 Bytes

Contents

module DeepCover
  module Tools::ExecuteSample
    # Returns true if the code would have continued, false if the rescue was triggered.
    def execute_sample(to_execute)
      # Disable some annoying warning by ruby. We are testing edge cases, so warnings are to be expected.
      begin
        Tools.silence_warnings do
          if to_execute.is_a?(CoveredCode)
            to_execute.execute_code
          else
            to_execute.call
          end
        end
        true
      rescue RuntimeError => e
         # In our samples, a simple `raise` doesn't need to be rescued
         # Other exceptions are not rescued
        raise unless e.message.empty?
        false
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
deep-cover-0.1.14 lib/deep_cover/tools/execute_sample.rb
deep-cover-0.1.13 lib/deep_cover/tools/execute_sample.rb
deep-cover-0.1.12 lib/deep_cover/tools/execute_sample.rb
deep-cover-0.1.11 lib/deep_cover/tools/execute_sample.rb
deep-cover-0.1.10 lib/deep_cover/tools/execute_sample.rb
deep-cover-0.1.9 lib/deep_cover/tools/execute_sample.rb
deep-cover-0.1.8 lib/deep_cover/tools/execute_sample.rb
deep-cover-0.1.7 lib/deep_cover/tools/execute_sample.rb
deep-cover-0.1.6 lib/deep_cover/tools/execute_sample.rb
deep-cover-0.1.5 lib/deep_cover/tools/execute_sample.rb
deep-cover-0.1.4 lib/deep_cover/tools/execute_sample.rb
deep-cover-0.1.3 lib/deep_cover/tools/execute_sample.rb
deep-cover-0.1.2 lib/deep_cover/tools/execute_sample.rb
deep-cover-0.1.1 lib/deep_cover/tools/execute_sample.rb