File: test.rake

package info (click to toggle)
ruby-sqlite3 2.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 680 kB
  • sloc: ruby: 4,827; ansic: 1,868; sh: 91; makefile: 7
file content (35 lines) | stat: -rw-r--r-- 784 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require "minitest/test_task"
test_config = lambda do |t|
  t.libs << "test"
  t.libs << "lib"

  glob = "test/**/test_*.rb"
  if t.respond_to?(:test_files=)
    t.test_files = FileList[glob] # Rake::TestTask (RubyMemcheck)
  else
    t.test_globs = [glob] # Minitest::TestTask
  end
end

Minitest::TestTask.create(:test, &test_config)

begin
  require "ruby_memcheck"
rescue LoadError => e
  warn("NOTE: ruby_memcheck is not available in this environment: #{e}")
end

class GdbTestTask < Minitest::TestTask
  def ruby(*args, **options, &block)
    command = "gdb --args #{RUBY} #{args.join(" ")}"
    sh(command, **options, &block)
  end
end

namespace :test do
  if defined?(RubyMemcheck)
    RubyMemcheck::TestTask.new(:valgrind, &test_config)
  end

  GdbTestTask.create(:gdb)
end