diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2022-06-23 11:22:36 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-06-24 10:52:02 +0900 |
commit | 12a5fa408bd318f8fb242e86beb225f2dcae8df9 (patch) | |
tree | f132650f5999535da69ee998956f260007afd371 /test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb | |
parent | 333754ace8ae9bc5d2dfb4aee160fcfa0f38350d (diff) |
Sync RubyGems & Bundler with upstream repo
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6054
Diffstat (limited to 'test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb')
-rw-r--r-- | test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb b/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb new file mode 100644 index 0000000000..3abcb83fa9 --- /dev/null +++ b/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb @@ -0,0 +1,33 @@ +# 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", ["-l", "static=ssp"]], + test_libstatic_with_colon_space: ["-l :libssp.a", ["-l", "static=ssp"]], + test_unconventional_lib_with_colon: ["-l:ssp.a", ["-C", "link_arg=-l:ssp.a"]], + test_dylib_with_colon_space: ["-l :libssp.dylib", ["-l", "dylib=ssp"]], + test_so_with_colon_space: ["-l :libssp.so", ["-l", "dylib=ssp"]], + test_dll_with_colon_space: ["-l :libssp.dll", ["-l", "dylib=ssp"]], + 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_arg=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 |