File: helper.rb

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 (26 lines) | stat: -rw-r--r-- 636 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
require "sqlite3"
require "minitest/autorun"
require "yaml"

puts SQLite3::VERSION_INFO.to_yaml

module SQLite3
  class TestCase < Minitest::Test
    alias_method :assert_not_equal, :refute_equal
    alias_method :assert_not_nil, :refute_nil
    alias_method :assert_raise, :assert_raises

    def assert_nothing_raised
      yield
    end

    def i_am_running_in_valgrind
      # https://stackoverflow.com/questions/365458/how-can-i-detect-if-a-program-is-running-from-within-valgrind/62364698#62364698
      ENV["LD_PRELOAD"] =~ /valgrind|vgpreload/
    end

    def windows?
      ::RUBY_PLATFORM =~ /mingw|mswin/
    end
  end
end