summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2024-10-16 16:45:49 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-10-16 17:04:36 +0900
commit1d7547f50d1187f49b5cfec627425e657cdaf9af (patch)
tree97624c5b4b4e4a6760d575c408e81e29d7d57596 /test
parentd45fb19ee579eb8b28e4dd565bf21c0044ceb326 (diff)
[ruby/yaml] Also use safe_load with each_value, values and shift
https://github.com/ruby/yaml/commit/f47d6123eb
Diffstat (limited to 'test')
-rw-r--r--test/yaml/test_dbm.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/yaml/test_dbm.rb b/test/yaml/test_dbm.rb
index c90b46a263..15d441d23b 100644
--- a/test/yaml/test_dbm.rb
+++ b/test/yaml/test_dbm.rb
@@ -22,4 +22,25 @@ class TestYAMLDBM < Test::Unit::TestCase
assert_equal "value", @dbm.delete("key")
assert_nil @dbm["key"]
end
+
+ def test_each_value
+ @dbm["key1"] = "value1"
+ @dbm["key2"] = "value2"
+ @dbm.each_value do |value|
+ assert_match(/value[12]/, value)
+ end
+ end
+
+ def test_values
+ @dbm["key1"] = "value1"
+ @dbm["key2"] = "value2"
+ @dbm.values.each do |value|
+ assert_match(/value[12]/, value)
+ end
+ end
+
+ def test_shift
+ @dbm["key"] = "value"
+ assert_equal ["key", "value"], @dbm.shift
+ end
end \ No newline at end of file