summaryrefslogtreecommitdiff
path: root/test/-ext-/struct/test_data.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-06-12 11:15:19 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-07-13 17:55:55 +0900
commit9c1fe9064c56cef3bde856d7fa1f907195af1003 (patch)
treea703b38cdb661ea4c72eb8d17b19f6c1566a0195 /test/-ext-/struct/test_data.rb
parentd426343418aab6148706860bd1678ac309dc12c0 (diff)
[Feature #19757] Add new API `rb_data_define`
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8066
Diffstat (limited to 'test/-ext-/struct/test_data.rb')
-rw-r--r--test/-ext-/struct/test_data.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/-ext-/struct/test_data.rb b/test/-ext-/struct/test_data.rb
new file mode 100644
index 0000000000..8dbc9113a5
--- /dev/null
+++ b/test/-ext-/struct/test_data.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: false
+require 'test/unit'
+require "-test-/struct"
+
+class Bug::Struct::Test_Data < Test::Unit::TestCase
+ def test_data_new_default
+ klass = Bug::Struct.data_new(false)
+ assert_equal Data, klass.superclass
+ assert_equal %i[mem1 mem2], klass.members
+ end
+
+ def test_data_new_superclass
+ superclass = Data.define
+ klass = Bug::Struct.data_new(superclass)
+ assert_equal superclass, klass.superclass
+ assert_equal %i[mem1 mem2], klass.members
+ end
+end