diff options
Diffstat (limited to 'test/rubygems/test_gem_ext_cmake_builder.rb')
-rw-r--r-- | test/rubygems/test_gem_ext_cmake_builder.rb | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/test/rubygems/test_gem_ext_cmake_builder.rb b/test/rubygems/test_gem_ext_cmake_builder.rb index b4d7cf2d30..5f886af05f 100644 --- a/test/rubygems/test_gem_ext_cmake_builder.rb +++ b/test/rubygems/test_gem_ext_cmake_builder.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true -require_relative 'helper' -require 'rubygems/ext' + +require_relative "helper" +require "rubygems/ext" class TestGemExtCmakeBuilder < Gem::TestCase def setup @@ -12,21 +13,21 @@ class TestGemExtCmakeBuilder < Gem::TestCase require "open3" begin - _, status = Open3.capture2e('cmake') - pend 'cmake not present' unless status.success? + _, status = Open3.capture2e("cmake") + pend "cmake not present" unless status.success? rescue Errno::ENOENT - pend 'cmake not present' + pend "cmake not present" end - @ext = File.join @tempdir, 'ext' - @dest_path = File.join @tempdir, 'prefix' + @ext = File.join @tempdir, "ext" + @dest_path = File.join @tempdir, "prefix" FileUtils.mkdir_p @ext FileUtils.mkdir_p @dest_path end def test_self_build - File.open File.join(@ext, 'CMakeLists.txt'), 'w' do |cmakelists| + File.open File.join(@ext, "CMakeLists.txt"), "w" do |cmakelists| cmakelists.write <<-EO_CMAKE cmake_minimum_required(VERSION 2.6) project(self_build NONE) @@ -34,7 +35,7 @@ install (FILES test.txt DESTINATION bin) EO_CMAKE end - FileUtils.touch File.join(@ext, 'test.txt') + FileUtils.touch File.join(@ext, "test.txt") output = [] @@ -42,11 +43,11 @@ install (FILES test.txt DESTINATION bin) output = output.join "\n" - assert_match %r{^cmake \. -DCMAKE_INSTALL_PREFIX\\=#{Regexp.escape @dest_path}}, output - assert_match %r{#{Regexp.escape @ext}}, output - assert_contains_make_command '', output - assert_contains_make_command 'install', output - assert_match %r{test\.txt}, output + assert_match(/^cmake \. -DCMAKE_INSTALL_PREFIX\\=#{Regexp.escape @dest_path}/, output) + assert_match(/#{Regexp.escape @ext}/, output) + assert_contains_make_command "", output + assert_contains_make_command "install", output + assert_match(/test\.txt/, output) end def test_self_build_fail @@ -58,16 +59,16 @@ install (FILES test.txt DESTINATION bin) output = output.join "\n" - shell_error_msg = %r{(CMake Error: .*)} + shell_error_msg = /(CMake Error: .*)/ - assert_match 'cmake failed', error.message + assert_match "cmake failed", error.message - assert_match %r{^cmake . -DCMAKE_INSTALL_PREFIX\\=#{Regexp.escape @dest_path}}, output - assert_match %r{#{shell_error_msg}}, output + assert_match(/^cmake . -DCMAKE_INSTALL_PREFIX\\=#{Regexp.escape @dest_path}/, output) + assert_match(/#{shell_error_msg}/, output) end def test_self_build_has_makefile - File.open File.join(@ext, 'Makefile'), 'w' do |makefile| + File.open File.join(@ext, "Makefile"), "w" do |makefile| makefile.puts "all:\n\t@echo ok\ninstall:\n\t@echo ok" end @@ -77,7 +78,7 @@ install (FILES test.txt DESTINATION bin) output = output.join "\n" - assert_contains_make_command '', output - assert_contains_make_command 'install', output + assert_contains_make_command "", output + assert_contains_make_command "install", output end end |