-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmjruby.rb
60 lines (49 loc) · 2.51 KB
/
mjruby.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
require 'open3'
require 'tmpdir'
BIN_PATH = File.join(File.dirname(__FILE__), "../mruby/bin/mjruby")
assert('setup') do
Dir.mktmpdir do |tmp_dir|
Dir.chdir(tmp_dir) do
output, status = Open3.capture2("#{BIN_PATH} -e \"puts 'Hello World'\"")
assert_true status.success?, "Process did not exit cleanly"
assert_include output, "Hello World"
output, status = Open3.capture2("#{BIN_PATH} -h")
assert_true status.success?, "Process did not exit cleanly"
assert_include output, "Usage: jruby"
output, status = Open3.capture2("#{BIN_PATH} -v")
assert_true status.success?, "Process did not exit cleanly"
assert_include output, "jruby 9.0.0.0 (2.2.2)"
output, status = Open3.capture2(
"#{BIN_PATH} --dev -rwebrick -J-Dsome.prop=foobar -J-Xmx256m -e \"puts 'Hello World'\"")
assert_true status.success?, "Process did not exit cleanly"
assert_include output, "Hello World"
output, status = Open3.capture2(
"#{BIN_PATH} --spawn --dev -rwebrick -J-Dsome.prop=foobar -J-Xmx256m -e \"puts 'Hello World'\"")
assert_true status.success?, "Process did not exit cleanly"
assert_include output, "Hello World"
output, error, status = Open3.capture3(
"#{BIN_PATH} -rwebrick -e 'puts WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd)'")
assert_true status.success?, "Process did not exit cleanly"
assert_include output, "WEBrick::HTTPServer"
assert_include error, "INFO WEBrick 1.3.1"
output, error, status = Open3.capture3(
"#{BIN_PATH} -J-X")
assert_true status.success?, "Process did not exit cleanly"
assert_include output, "(Prepend -J in front of these options when using 'jruby' command)"
assert_include error, "The -X options are non-standard and subject to change without notice."
output, error, status = Open3.capture3(
"#{BIN_PATH} -J")
assert_true status.success?, "Process did not exit cleanly"
assert_include output, "(Prepend -J in front of these options when using 'jruby' command)"
assert_include error, "Usage: java"
output, status = Open3.capture2(
"#{BIN_PATH} -J-ea -e \"puts 'Hello World'\"")
assert_true status.success?, "Process did not exit cleanly"
assert_include output, "Hello World"
output, status = Open3.capture2(
"#{BIN_PATH} -S gem install bundler")
assert_true status.success?, "Process did not exit cleanly"
assert_include output, "1 gem installed"
end
end
end