summaryrefslogtreecommitdiff
path: root/test/reline
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-02 12:14:29 +0900
committeraycabta <aycabta@gmail.com>2019-06-02 22:58:05 +0900
commitf4b060d8d7f927306cbbe24df888a09112acd4c8 (patch)
tree3bf5dfe35705f59a57ea27ce05b6a6aa6794c023 /test/reline
parenta1e6e45341d70c608b7b5af98be0f234fd0072fb (diff)
Check conditional nestings in INPUTRC
Closes: https://github.com/ruby/ruby/pull/2222
Diffstat (limited to 'test/reline')
-rw-r--r--test/reline/test_config.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/reline/test_config.rb b/test/reline/test_config.rb
index d6f1ce5253..c00c4f8236 100644
--- a/test/reline/test_config.rb
+++ b/test/reline/test_config.rb
@@ -117,6 +117,33 @@ class Reline::Config::Test < Reline::TestCase
end
end
+ def test_unclosed_if
+ e = assert_raise(Reline::Config::InvalidInputrc) do
+ @config.read_lines(<<~LINES.split(/(?<=\n)/), "INPUTRC")
+ $if Ruby
+ LINES
+ end
+ assert_equal "INPUTRC:1: unclosed if", e.message
+ end
+
+ def test_unmatched_else
+ e = assert_raise(Reline::Config::InvalidInputrc) do
+ @config.read_lines(<<~LINES.split(/(?<=\n)/), "INPUTRC")
+ $else
+ LINES
+ end
+ assert_equal "INPUTRC:1: unmatched else", e.message
+ end
+
+ def test_unmatched_endif
+ e = assert_raise(Reline::Config::InvalidInputrc) do
+ @config.read_lines(<<~LINES.split(/(?<=\n)/), "INPUTRC")
+ $endif
+ LINES
+ end
+ assert_equal "INPUTRC:1: unmatched endif", e.message
+ end
+
def test_default_key_bindings
@config.add_default_key_binding('abcd'.bytes, 'EFGH'.bytes)
@config.read_lines(<<~'LINES'.split(/^/))