@@ -11,7 +11,7 @@ class TestBuilderBase
11
11
end
12
12
13
13
class LocalTestBuilder < TestBuilderBase
14
- def initialize ( target , m , c )
14
+ def initialize ( target , m , c , name )
15
15
@target_path = File . absolute_path ( target [ 0 ] )
16
16
@current_time = Time . now . to_i
17
17
m = "test_#{ @current_time } " if m . nil?
@@ -23,6 +23,7 @@ def initialize(target, m, c)
23
23
else
24
24
@class = "#{ c_upcase } Test"
25
25
end
26
+ @file_name = name || @class . sub ( /(?i:t)est/ , '' ) . gsub ( /([[:upper:]])/ ) { "_#{ $1. downcase } " } . delete_prefix ( '_' )
26
27
end
27
28
28
29
def start
@@ -211,12 +212,8 @@ def make_content
211
212
" end" + create_scenario_and_program
212
213
end
213
214
214
- def file_name
215
- @class . sub ( /(?i:t)est/ , '' ) . gsub ( /([[:upper:]])/ ) { "_#{ $1. downcase } " } . delete_prefix ( '_' )
216
- end
217
-
218
215
def create_file
219
- path = "#{ __dir__ } /../debug/#{ file_name } _test.rb"
216
+ path = "#{ __dir__ } /../debug/#{ @ file_name} _test.rb"
220
217
if File . exist? ( path )
221
218
@inserted_src = File . read ( path )
222
219
content = @inserted_src . split ( "\n " ) [ 0 ..-3 ] . join ( "\n " ) + "\n #{ make_content } \n end\n " if @inserted_src . include? @class
@@ -239,7 +236,7 @@ class DAPTestBuilder < TestBuilderBase
239
236
RUBY = ENV [ 'RUBY' ] || RbConfig . ruby
240
237
RDBG_EXECUTABLE = "#{ RUBY } #{ __dir__ } /../../exe/rdbg"
241
238
242
- def initialize ( target , m , c )
239
+ def initialize ( target , m , c , name )
243
240
@target_path = File . absolute_path ( target [ 0 ] )
244
241
@current_time = Time . now . to_i
245
242
m = "test_#{ @current_time } " if m . nil?
@@ -251,6 +248,7 @@ def initialize(target, m, c)
251
248
else
252
249
@class = "#{ c_upcase } Test"
253
250
end
251
+ @file_name = name || @class . sub ( /(?i:t)est/ , '' ) . gsub ( /([[:upper:]])/ ) { "_#{ $1. downcase } " } . delete_prefix ( '_' )
254
252
end
255
253
256
254
def start
@@ -423,7 +421,7 @@ def file_name
423
421
end
424
422
425
423
def create_file
426
- path = "#{ __dir__ } /../protocol/#{ file_name } _test.rb"
424
+ path = "#{ __dir__ } /../protocol/#{ @ file_name} _test.rb"
427
425
if File . exist? ( path )
428
426
@inserted_src = File . read ( path )
429
427
content = @inserted_src . split ( "\n " ) [ 0 ..-3 ] . join ( "\n " ) + "\n #{ make_content } \n end\n " if @inserted_src . include? @class
@@ -446,7 +444,7 @@ class CDPTestBuilder < TestBuilderBase
446
444
RUBY = ENV [ 'RUBY' ] || RbConfig . ruby
447
445
RDBG_EXECUTABLE = "#{ RUBY } #{ __dir__ } /../../exe/rdbg"
448
446
449
- def initialize ( target , m , c )
447
+ def initialize ( target , m , c , name )
450
448
@target_path = File . absolute_path ( target [ 0 ] )
451
449
@current_time = Time . now . to_i
452
450
m = "test_#{ @current_time } " if m . nil?
@@ -458,6 +456,7 @@ def initialize(target, m, c)
458
456
else
459
457
@class = "#{ c_upcase } Test"
460
458
end
459
+ @file_name = name || @class . sub ( /(?i:t)est/ , '' ) . gsub ( /([[:upper:]])/ ) { "_#{ $1. downcase } " } . delete_prefix ( '_' )
461
460
end
462
461
463
462
def start
@@ -658,12 +657,8 @@ def make_content
658
657
" end" + create_scenario_and_program
659
658
end
660
659
661
- def file_name
662
- @class . sub ( /(?i:t)est/ , '' ) . gsub ( /([[:upper:]])/ ) { "_#{ $1. downcase } " } . delete_prefix ( '_' )
663
- end
664
-
665
660
def create_file
666
- path = "#{ __dir__ } /../protocol/#{ file_name } _test.rb"
661
+ path = "#{ __dir__ } /../protocol/#{ @ file_name} _test.rb"
667
662
if File . exist? ( path )
668
663
@inserted_src = File . read ( path )
669
664
content = @inserted_src . split ( "\n " ) [ 0 ..-3 ] . join ( "\n " ) + "\n #{ make_content } \n end\n " if @inserted_src . include? @class
0 commit comments