Class: RubyMemcheck::TestTask

Inherits:
Rake::TestTask
  • Object
show all
Defined in:
lib/ruby_memcheck/test_task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ TestTask

Returns a new instance of TestTask.



8
9
10
11
12
13
14
15
16
17
# File 'lib/ruby_memcheck/test_task.rb', line 8

def initialize(*args)
  @configuration =
    if !args.empty? && args[0].is_a?(Configuration)
      args.shift
    else
      RubyMemcheck.default_configuration
    end

  super
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



5
6
7
# File 'lib/ruby_memcheck/test_task.rb', line 5

def configuration
  @configuration
end

#reporterObject (readonly)

Returns the value of attribute reporter.



6
7
8
# File 'lib/ruby_memcheck/test_task.rb', line 6

def reporter
  @reporter
end

Instance Method Details

#ruby(*args, **options, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ruby_memcheck/test_task.rb', line 19

def ruby(*args, **options, &block)
  command = configuration.command(args)

  @reporter = TestTaskReporter.new(configuration)

  @reporter.setup

  sh(command, **options) do |ok, res|
    @reporter.report_valgrind_errors

    yield ok, res if block_given?
  end
end