mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Avoid array object creation in cmd_bin method in bintest
Simply reverse the calling direction of `cmd_bin` method and `cmd_list` method.
This commit is contained in:
+5
-6
@@ -3,14 +3,17 @@ require 'test/assert.rb'
|
||||
|
||||
GEMNAME = ""
|
||||
|
||||
def cmd_list(s)
|
||||
def cmd_bin(s)
|
||||
path = s == "mrbc" ? ENV['MRBCFILE'] : "#{ENV['BUILD_DIR']}/bin/#{s}"
|
||||
path = path.sub(/\.exe\z/, "")
|
||||
if /mswin(?!ce)|mingw|bccwin/ =~ RbConfig::CONFIG['host_os']
|
||||
path = "#{path}.exe".tr("/", "\\")
|
||||
end
|
||||
path
|
||||
end
|
||||
|
||||
path_list = [path]
|
||||
def cmd_list(s)
|
||||
path_list = [cmd_bin(s)]
|
||||
|
||||
emu = ENV['EMULATOR']
|
||||
path_list.unshift emu if emu && !emu.empty?
|
||||
@@ -22,10 +25,6 @@ def cmd(s)
|
||||
cmd_list(s).join(' ')
|
||||
end
|
||||
|
||||
def cmd_bin(s)
|
||||
cmd_list(s).pop
|
||||
end
|
||||
|
||||
def shellquote(s)
|
||||
case RbConfig::CONFIG['host_os']
|
||||
when /mswin(?!ce)|mingw|bccwin/
|
||||
|
||||
Reference in New Issue
Block a user