Skip to content

Commit d2f27e4

Browse files
committed
Fix RSTRING_PTR
1 parent 1073839 commit d2f27e4

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

_tools/ruby_h_to_go/spec/ruby_h_to_go/function_definition_spec.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,36 @@
502502

503503
it { should eq go_content }
504504
end
505+
506+
context "RSTRING_PTR" do
507+
let(:definition) do
508+
RubyHeaderParser::FunctionDefinition.new(
509+
name: "RSTRING_PTR",
510+
definition: "RSTRING_PTR(VALUE str)",
511+
typeref: typeref(type: "char", pointer: :raw),
512+
args: [
513+
argument(type: "VALUE", name: "str"),
514+
],
515+
)
516+
end
517+
518+
let(:go_content) do
519+
<<~GO
520+
// RSTRING_PTR calls `RSTRING_PTR` in C
521+
//
522+
// Original definition is following
523+
//
524+
// RSTRING_PTR(VALUE str)
525+
func RSTRING_PTR(str VALUE) *Char {
526+
ret := (*Char)(C.RSTRING_PTR(C.VALUE(str)))
527+
return ret
528+
}
529+
530+
GO
531+
end
532+
533+
it { should eq go_content }
534+
end
505535
end
506536

507537
describe "#go_function_name" do

ruby/function_generated.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)