summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2024-10-16 16:33:00 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-10-16 17:04:35 +0900
commit623897c97ee56b05668c29829634a4b89e145393 (patch)
tree1ff510eb0c3285cbdd76015e5e0a6a0f35ef66b9
parentfdcdc05b422301c9d3b7872872fb875c57d1080f (diff)
[ruby/yaml] Added basic test cases
https://github.com/ruby/yaml/commit/36a339c0d7
-rw-r--r--test/yaml/test_dbm.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/yaml/test_dbm.rb b/test/yaml/test_dbm.rb
new file mode 100644
index 0000000000..c90b46a263
--- /dev/null
+++ b/test/yaml/test_dbm.rb
@@ -0,0 +1,25 @@
+require "test/unit"
+require "yaml/dbm"
+
+class TestYAMLDBM < Test::Unit::TestCase
+ def setup
+ @dbm = YAML::DBM.new("test")
+ end
+
+ def teardown
+ @dbm.close
+ File.unlink("test.db")
+ end
+
+ def test_fetch
+ @dbm["key"] = "value"
+ assert_equal "value", @dbm["key"]
+ assert_equal "value", @dbm.fetch("key")
+ end
+
+ def test_delete
+ @dbm["key"] = "value"
+ assert_equal "value", @dbm.delete("key")
+ assert_nil @dbm["key"]
+ end
+end \ No newline at end of file