File: integration_test.rake

package info (click to toggle)
ruby-liquid-c 4.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 504 kB
  • sloc: ansic: 3,866; ruby: 1,151; makefile: 7
file content (43 lines) | stat: -rw-r--r-- 1,261 bytes parent folder | download | duplicates (2)
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
36
37
38
39
40
41
42
43
# frozen_string_literal: true

namespace :test do
  integration_test_config = lambda do |t|
    t.libs << "lib"
    t.test_files = ["test/integration_test.rb"]
  end

  desc "run test suite with default parser"
  Rake::TestTask.new(integration: :compile, &integration_test_config)

  namespace :integration do
    define_env_integration_tests = lambda do |task_name|
      rake_task = Rake::Task[task_name]

      [
        [:lax, { "LIQUID_PARSER_MODE" => "lax" }],
        [:strict, { "LIQUID_PARSER_MODE" => "strict" }],
        [:without_vm, { "LIQUID_C_DISABLE_VM" => "true" }],
      ].each do |name, env_vars|
        task(name) do
          old_env_values = ENV.to_hash.slice(*env_vars.keys)
          begin
            env_vars.each { |key, value| ENV[key] = value }
            rake_task.invoke
          ensure
            old_env_values.each { |key, value| ENV[key] = value }
            rake_task.reenable
          end
        end
      end

      task(all: [:lax, :strict, :without_vm])
    end

    define_env_integration_tests.call("test:integration")

    RubyMemcheck::TestTask.new(valgrind: :compile, &integration_test_config)
    namespace :valgrind do
      define_env_integration_tests.call("test:integration:valgrind")
    end
  end
end