Sha256: effbd11401982366c85e7be90cdbdc19109e7223ff5b9f2cf5bd03d025a4e509

Contents?: true

Size: 1.65 KB

Versions: 75

Compression:

Stored size: 1.65 KB

Contents

require File.expand_path('../helper', __FILE__)

class TestCMake < TestCase
  attr_accessor :assets_path, :tar_path, :recipe

  def before_all
    super
    return if MiniPortile.windows?

    @assets_path = File.expand_path("../assets", __FILE__)
    @tar_path = File.expand_path("../../tmp/test-cmake-1.0.tar.gz", __FILE__)

    # remove any previous test files
    FileUtils.rm_rf("tmp")

    create_tar(@tar_path, @assets_path, "test-cmake-1.0")
    start_webrick(File.dirname(@tar_path))

    @recipe = MiniPortileCMake.new("test-cmake", "1.0").tap do |recipe|
      recipe.files << "http://localhost:#{HTTP_PORT}/#{ERB::Util.url_encode(File.basename(@tar_path))}"
      recipe.patch_files << File.join(@assets_path, "patch 1.diff")
      recipe.configure_options << "--option=\"path with 'space'\""
      git_dir = File.join(@assets_path, "git")
      with_custom_git_dir(git_dir) do
        recipe.cook
      end
    end
  end

  def after_all
    super
    return if MiniPortile.windows?

    stop_webrick
    # leave test files for inspection
  end

  def test_cmake_inherits_from_base
    assert(MiniPortileCMake <= MiniPortile)
  end

  def test_configure
    skip if MiniPortile.windows?

    cmakecache = File.join(work_dir, "CMakeCache.txt")
    assert File.exist?(cmakecache), cmakecache

    assert_includes(IO.read(cmakecache), "CMAKE_INSTALL_PREFIX:PATH=#{recipe.path}")
  end

  def test_compile
    skip if MiniPortile.windows?

    binary = File.join(work_dir, "hello")
    assert File.exist?(binary), binary
  end

  def test_install
    skip if MiniPortile.windows?

    binary = File.join(recipe.path, "bin", "hello")
    assert File.exist?(binary), binary
  end
end

Version data entries

75 entries across 62 versions & 14 rubygems

Version Path
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/mini_portile2-2.4.0/test/test_cmake.rb
tdiary-5.1.2 vendor/bundle/ruby/2.7.0/gems/mini_portile2-2.4.0/test/test_cmake.rb
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/mini_portile2-2.4.0/test/test_cmake.rb
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/mini_portile2-2.4.0/test/test_cmake.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/mini_portile2-2.4.0/test/test_cmake.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/mini_portile2-2.4.0/test/test_cmake.rb
tdiary-5.1.1 vendor/bundle/ruby/2.7.0/gems/mini_portile2-2.4.0/test/test_cmake.rb
mini_portile2-2.5.0 test/test_cmake.rb
husc-0.2.1 vendor/bundle/gems/mini_portile2-2.4.0/test/test_cmake.rb
husc-0.2.0 vendor/bundle/gems/mini_portile2-2.4.0/test/test_cmake.rb
husc-0.1.1 vendor/bundle/gems/mini_portile2-2.4.0/test/test_cmake.rb
husc-0.1.0 vendor/bundle/gems/mini_portile2-2.4.0/test/test_cmake.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/mini_portile2-2.4.0/test/test_cmake.rb
tdiary-5.1.0 vendor/bundle/gems/mini_portile2-2.4.0/test/test_cmake.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/mini_portile2-2.4.0/test/test_cmake.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/mini_portile2-2.4.0/test/test_cmake.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/mini_portile2-2.4.0/test/test_cmake.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/mini_portile2-2.4.0/test/test_cmake.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/mini_portile2-2.4.0/test/test_cmake.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/mini_portile2-2.4.0/test/test_cmake.rb