File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ def write_go_file(dist_dir)
38
38
39
39
# @return [String]
40
40
def generate_go_content
41
- go_function_name = snake_to_camel ( name )
42
41
go_function_args = args . map ( &:go_function_arg )
43
42
44
43
go_function_typeref = typeref . go_function_typeref
@@ -119,5 +118,12 @@ def generate_go_content
119
118
120
119
go_function_lines . join ( "\n " )
121
120
end
121
+
122
+ # @return [String]
123
+ def go_function_name
124
+ return name if name . match? ( /^[A-Z0-9_]+$/ )
125
+
126
+ snake_to_camel ( name )
127
+ end
122
128
end
123
129
end
Original file line number Diff line number Diff line change 199
199
it { should eq go_content }
200
200
end
201
201
end
202
+
203
+ describe "#go_function_name" do
204
+ subject { RubyHToGo ::FunctionDefinition . new ( definition :) . go_function_name }
205
+
206
+ let ( :definition ) do
207
+ RubyHeaderParser ::FunctionDefinition . new (
208
+ name : name ,
209
+ definition : "" ,
210
+ typeref : typedef ( type : "void" ) ,
211
+ args : [ ] ,
212
+ )
213
+ end
214
+
215
+ using RSpec ::Parameterized ::TableSyntax
216
+
217
+ where ( :name , :expected ) do
218
+ "RB_FIX2INT" | "RB_FIX2INT"
219
+ "rb_fix2int" | "RbFix2Int"
220
+ end
221
+
222
+ with_them do
223
+ it { should eq expected }
224
+ end
225
+ end
202
226
end
You can’t perform that action at this time.
0 commit comments