summaryrefslogtreecommitdiff
path: root/test/shell/test_command_processor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/shell/test_command_processor.rb')
-rw-r--r--test/shell/test_command_processor.rb33
1 files changed, 32 insertions, 1 deletions
diff --git a/test/shell/test_command_processor.rb b/test/shell/test_command_processor.rb
index 2d3f8a4b1a..51e14b5a69 100644
--- a/test/shell/test_command_processor.rb
+++ b/test/shell/test_command_processor.rb
@@ -1,6 +1,6 @@
+# frozen_string_literal: false
require 'shell'
require 'tmpdir'
-require_relative '../ruby/envutil'
class TestShell < Test::Unit::TestCase
end
@@ -66,4 +66,35 @@ class TestShell::CommandProcessor < Test::Unit::TestCase
Process.waitall
Dir.rmdir(path)
end
+
+ def test_test
+ name = "foo#{exeext}"
+ path = File.join(@tmpdir, name)
+ open(path, "w", 0644) {}
+
+ assert_equal(true, @shell[?e, path])
+ assert_equal(true, @shell[:e, path])
+ assert_equal(true, @shell["e", path])
+ assert_equal(true, @shell[:exist?, path])
+ assert_equal(true, @shell["exist?", path])
+ assert_raise_with_message(RuntimeError, /unsupported command/) do
+ assert_equal(true, @shell[:instance_eval, path])
+ end
+ ensure
+ Process.waitall
+ File.unlink(path)
+ end
+
+ def test_option_type
+ name = 'foo.cmd'
+ path = File.join(@tmpdir, name)
+
+ open(path, 'w', 0755) {}
+ assert_raise(TypeError) {
+ catch(catch_command_start) {@shell.system(name, 42)}
+ }
+ ensure
+ Process.waitall
+ File.unlink(path)
+ end
end