Debian Codegraph @

vendor/mruby-source/test/bintest.rb

raw
1 $:.unshift File.dirname(File.dirname(File.expand_path(__FILE__)))
2 require 'test/assert.rb'
3
4 GEMNAME = ""
5
6 def cmd_list(s)
7 path = s == "mrbc" ? ENV['MRBCFILE'] : "#{ENV['BUILD_DIR']}/bin/#{s}"
8 path = path.sub(/\.exe\z/, "")
9 if /mswin(?!ce)|mingw|bccwin/ =~ RbConfig::CONFIG['host_os']
10 path = "#{path}.exe".tr("/", "\\")
11 end
12
13 path_list = [path]
14
15 emu = ENV['EMULATOR']
16 path_list.unshift emu if emu && !emu.empty?
17
18 path_list
19 end
20
21 def cmd(s)
22 cmd_list(s).join(' ')
23 end
24
25 def cmd_bin(s)
26 cmd_list(s).pop
27 end
28
29 def shellquote(s)
30 case RbConfig::CONFIG['host_os']
31 when /mswin(?!ce)|mingw|bccwin/
32 "\"#{s}\""
33 else
34 "'#{s}'"
35 end
36 end
37
38 print "bintest - Command Binary Test\n\n"
39
40 ARGV.each do |gem|
41 case gem
42 when '-v'; $mrbtest_verbose = true
43 end
44
45 case RbConfig::CONFIG['host_os']
46 when /mswin(?!ce)|mingw|bccwin/
47 gem = gem.tr('\\', '/')
48 end
49
50 Dir["#{gem}/bintest/**/*.rb"].each do |file|
51 GEMNAME.replace(File.basename(gem))
52 load file
53 end
54 end
55
56 exit report