aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_specification.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_specification.rb')
-rw-r--r--test/rubygems/test_gem_specification.rb61
1 files changed, 61 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 60f603361a..1ca2046195 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -2128,6 +2128,27 @@ dependencies: []
assert_nil @ext.to_fullpath("notexist")
end
+ def test_fullpath_return_rb_extension_file_when_exist_the_same_name_file
+ ext_spec
+
+ @ext.require_paths = 'lib'
+
+ dir = File.join(@gemhome, 'gems', @ext.original_name, 'lib')
+ expected_rb = File.join(dir, 'code.rb')
+ FileUtils.mkdir_p dir
+ FileUtils.touch expected_rb
+
+ dir = @ext.extension_dir
+ ext = RbConfig::CONFIG["DLEXT"]
+ expected_so = File.join(dir, "code.#{ext}")
+ FileUtils.mkdir_p dir
+ FileUtils.touch expected_so
+
+ @ext.activate
+
+ assert_equal expected_rb, @ext.to_fullpath("code")
+ end
+
def test_require_already_activated
save_loaded_features do
a1 = new_spec "a", "1", nil, "lib/d.rb"
@@ -2874,6 +2895,46 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
warning
end
+ def test_validate_license_values_plus
+ util_setup_validate
+
+ use_ui @ui do
+ @a1.licenses = ['GPL-2.0+']
+ @a1.validate
+ end
+
+ assert_empty @ui.error
+ end
+
+ def test_validate_license_values_with
+ util_setup_validate
+
+ use_ui @ui do
+ @a1.licenses = ['GPL-2.0+ WITH Autoconf-exception-2.0']
+ @a1.validate
+ end
+
+ assert_empty @ui.error
+ end
+
+ def test_validate_license_with_nonsense_suffix
+ util_setup_validate
+
+ use_ui @ui do
+ @a1.licenses = ['GPL-2.0+ FOO', 'GPL-2.0 FOO']
+ @a1.validate
+ end
+
+ assert_match <<-warning, @ui.error
+WARNING: license value 'GPL-2.0+ FOO' is invalid. Use a license identifier from
+http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
+ warning
+ assert_match <<-warning, @ui.error
+WARNING: license value 'GPL-2.0 FOO' is invalid. Use a license identifier from
+http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
+ warning
+ end
+
def test_validate_name
util_setup_validate