summaryrefslogtreecommitdiff
path: root/test/rubygems
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-04-18 11:03:50 +0900
committergit <svn-admin@ruby-lang.org>2023-04-19 06:56:23 +0000
commit62e5ba537acbb439366ddfa99992c1151df55a24 (patch)
treef1ab32c1e0dca1459c3ab1748cb2741e58ea4767 /test/rubygems
parent8b95b33a9d114d2f9f3852c289722c8393d10fd8 (diff)
downloadruby-62e5ba537acbb439366ddfa99992c1151df55a24.tar.gz
[rubygems/rubygems] Added tests for load_with_rubygems_config_hash and dump_with_rubygems_yaml
https://github.com/rubygems/rubygems/commit/0393f24119
Diffstat (limited to 'test/rubygems')
-rw-r--r--test/rubygems/test_gem_config_file.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb
index 0c6763c6a3..28651d2e9a 100644
--- a/test/rubygems/test_gem_config_file.rb
+++ b/test/rubygems/test_gem_config_file.rb
@@ -500,4 +500,32 @@ if you believe they were disclosed to a third party.
util_config_file
assert_equal(true, @cfg.disable_default_gem_server)
end
+
+ def test_load_with_rubygems_config_hash
+ yaml = <<~YAML
+ ---
+ :foo: bar
+ bar: 100
+ buzz: true
+ alpha: :bravo
+ charlie: ""
+ delta:
+ YAML
+ actual = Gem::ConfigFile.load_with_rubygems_config_hash(yaml)
+
+ assert_equal "bar", actual[:foo]
+ assert_equal 100, actual["bar"]
+ assert_equal true, actual["buzz"]
+ assert_equal :bravo, actual["alpha"]
+ assert_equal nil, actual["charlie"]
+ assert_equal nil, actual["delta"]
+ end
+
+ def test_dump_with_rubygems_yaml
+ symbol_key_hash = { :foo => "bar" }
+
+ actual = Gem::ConfigFile.dump_with_rubygems_yaml(symbol_key_hash)
+
+ assert_equal("---\n:foo: \"bar\"\n", actual)
+ end
end