summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/shell/command-processor.rb3
-rw-r--r--test/shell/test_command_processor.rb18
-rw-r--r--version.h2
3 files changed, 22 insertions, 1 deletions
diff --git a/lib/shell/command-processor.rb b/lib/shell/command-processor.rb
index 2239ca98f6..b50f4003a7 100644
--- a/lib/shell/command-processor.rb
+++ b/lib/shell/command-processor.rb
@@ -180,6 +180,9 @@ class Shell
top_level_test(command, file1)
end
else
+ unless FileTest.methods(false).include?(command.to_sym)
+ raise "unsupported command: #{ command }"
+ end
if file2
FileTest.send(command, file1, file2)
else
diff --git a/test/shell/test_command_processor.rb b/test/shell/test_command_processor.rb
index 99fe1b222a..6626befb79 100644
--- a/test/shell/test_command_processor.rb
+++ b/test/shell/test_command_processor.rb
@@ -66,4 +66,22 @@ 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
end
diff --git a/version.h b/version.h
index 5652cc0818..2b98ded13d 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.4.8"
#define RUBY_RELEASE_DATE "2019-10-01"
-#define RUBY_PATCHLEVEL 360
+#define RUBY_PATCHLEVEL 361
#define RUBY_RELEASE_YEAR 2019
#define RUBY_RELEASE_MONTH 10