Sha256: 9b18c94700fcee398ce46d28ba1d962862d2394c9acfe0252f9cd911904d1cdb

Contents?: true

Size: 1.72 KB

Versions: 5

Compression:

Stored size: 1.72 KB

Contents

# frozen_string_literal: true

require_relative "helper"
require "rubygems/ext"
require "rubygems/ext/cargo_builder/link_flag_converter"

class TestGemExtCargoBuilderLinkFlagConverter < Gem::TestCase
  CASES = {
    test_search_path_basic: ["-L/usr/local/lib", ["-L", "native=/usr/local/lib"]],
    test_search_path_space: ["-L /usr/local/lib", ["-L", "native=/usr/local/lib"]],
    test_search_path_space_in_path: ["-L/usr/local/my\ lib", ["-L", "native=/usr/local/my\ lib"]],
    test_simple_lib: ["-lfoo", ["-l", "foo"]],
    test_lib_with_nonascii: ["-lws2_32", ["-l", "ws2_32"]],
    test_simple_lib_space: ["-l foo", ["-l", "foo"]],
    test_verbose_lib_space: ["--library=foo", ["-l", "foo"]],
    test_libstatic_with_colon: ["-l:libssp.a", ["-C", "link-args=-l:libssp.a"]],
    test_libstatic_with_colon_space: ["-l :libssp.a", ["-C", "link-args=-l :libssp.a"]],
    test_unconventional_lib_with_colon: ["-l:ssp.a", ["-C", "link-args=-l:ssp.a"]],
    test_dylib_with_colon_space: ["-l :libssp.dylib", ["-C", "link-args=-l :libssp.dylib"]],
    test_so_with_colon_space: ["-l :libssp.so", ["-C", "link-args=-l :libssp.so"]],
    test_dll_with_colon_space: ["-l :libssp.dll", ["-C", "link-args=-l :libssp.dll"]],
    test_framework: ["-F/some/path", ["-l", "framework=/some/path"]],
    test_framework_space: ["-F /some/path", ["-l", "framework=/some/path"]],
    test_non_lib_dash_l: ["test_rubygems_20220413-976-lemgf9/prefix", ["-C", "link-args=test_rubygems_20220413-976-lemgf9/prefix"]],
  }.freeze

  CASES.each do |test_name, (arg, expected)|
    raise "duplicate test name" if instance_methods.include?(test_name)

    define_method(test_name) do
      assert_equal(expected, Gem::Ext::CargoBuilder::LinkFlagConverter.convert(arg))
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubygems-update-3.4.22 test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb
rubygems-update-3.4.21 test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb
rubygems-update-3.4.20 test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb
rubygems-update-3.4.19 test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb
rubygems-update-3.4.18 test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb