Skip to content

Commit 52ee690

Browse files
MSP-Gregeregon
authored andcommitted
cli_test.rb - add erb, test-unit & typeprof, fix bundler
1 parent 093287c commit 52ee690

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

cli_test.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ class << self
88

99
def chk_cli(cmd, regex)
1010
cmd_str = cmd[/\A[^ ]+/].ljust(10)
11-
if File.exist? "#{BIN_DIR}/#{cmd_str}".strip
11+
cmd_path = "#{BIN_DIR}/#{cmd_str}".strip
12+
if File.exist? cmd_path.strip
13+
if RUBY_PLATFORM[/mingw|mswin/]
14+
unless File.exist?("#{cmd_path}.bat") || File.exist?("#{cmd_path}.cmd")
15+
return "#{cmd_str}❌ missing windows binstub"
16+
end
17+
end
1218
require 'open3'
1319
ret = ''.dup
1420
Open3.popen3(cmd) {|stdin, stdout, stderr, wait_thr|
1521
ret = stdout.read.strip
22+
ret = stderr.read.strip if ret.empty?
1623
}
1724
if ret[regex]
1825
"#{cmd_str}#{$1}"
@@ -26,21 +33,24 @@ def chk_cli(cmd, regex)
2633
end
2734
rescue => e
2835
@error += 1
29-
"#{cmd_str}#{e.class}"
36+
"#{cmd_str}#{e.class} #{e.message}"
3037
end
3138

3239
def run
3340
re_version = '(\d{1,2}\.\d{1,2}\.\d{1,2}(\.[a-z0-9.]+)?)'
3441
@error = 0
3542
puts "\n#{DASH * 5} CLI Test #{DASH * 17}"
36-
puts chk_cli("bundle -v", /\ABundler version #{re_version}/)
43+
puts chk_cli("bundle -v", /\A(?:Bundler version )?#{re_version}/)
44+
puts chk_cli("erb --version", /\A#{re_version}/)
3745
puts chk_cli("gem --version", /\A#{re_version}/)
3846
puts chk_cli("irb --version", /\Airb +#{re_version}/)
3947
puts chk_cli("racc --version", /\Aracc version #{re_version}/)
4048
puts chk_cli("rake -V", /\Arake, version #{re_version}/)
4149
puts chk_cli("rbs -v" , /\Arbs #{re_version}/)
4250
puts chk_cli("rdbg -v", /\Ardbg #{re_version}/)
4351
puts chk_cli("rdoc -v", /\A#{re_version}/)
52+
puts chk_cli("test-unit --version", /\A(?:test-unit )?#{re_version}/)
53+
puts chk_cli("typeprof --version", /#{re_version}\z/)
4454
puts ''
4555

4656
cli_desc = %x[ruby -v].strip

0 commit comments

Comments
 (0)