Skip to content

Commit d7d5836

Browse files
committed
Add test to reproduce the issue reported in GH-66
1 parent e0498e6 commit d7d5836

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/fiddle/test_struct.rb

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# frozen_string_literal: true
2+
begin
3+
require_relative 'helper'
4+
rescue LoadError
5+
end
6+
7+
module Fiddle
8+
class TestStruct < TestCase
9+
# https://github.com/ruby/fiddle/issues/66
10+
def test_clone_gh_66
11+
s = Fiddle::Importer.struct(["int i"])
12+
a = s.malloc
13+
a.i = 10
14+
b = a.clone
15+
b.i = 20
16+
assert_equal({a: 10, b: 20},
17+
{a: a.i, b: b.i})
18+
end
19+
end
20+
end

0 commit comments

Comments
 (0)