summaryrefslogtreecommitdiff
path: root/test/readline/test_readline.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/readline/test_readline.rb')
-rw-r--r--test/readline/test_readline.rb25
1 files changed, 16 insertions, 9 deletions
diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb
index e7093f7bd3..7fdbc87125 100644
--- a/test/readline/test_readline.rb
+++ b/test/readline/test_readline.rb
@@ -16,11 +16,15 @@ class TestReadline < Test::Unit::TestCase
stdin.write("hello\n")
stdin.close
stdout.close
- line = replace_stdio(stdin.path, stdout.path) { Readline.readline("> ") }
+ line = replace_stdio(stdin.path, stdout.path) {
+ Readline.readline("> ", true)
+ }
assert_equal("hello", line)
assert_equal(true, line.tainted?)
stdout.open
assert_equal("> ", stdout.read(2))
+ assert_equal(1, Readline::HISTORY.length)
+ assert_equal("hello", Readline::HISTORY[0])
assert_raises(SecurityError) do
Thread.start {
$SAFE = 1
@@ -42,14 +46,17 @@ class TestReadline < Test::Unit::TestCase
end
def test_completion_append_character
- Readline.completion_append_character = "x"
- assert_equal("x", Readline.completion_append_character)
- Readline.completion_append_character = "xyz"
- assert_equal("x", Readline.completion_append_character)
- Readline.completion_append_character = nil
- assert_equal(nil, Readline.completion_append_character)
- Readline.completion_append_character = ""
- assert_equal(nil, Readline.completion_append_character)
+ begin
+ Readline.completion_append_character = "x"
+ assert_equal("x", Readline.completion_append_character)
+ Readline.completion_append_character = "xyz"
+ assert_equal("x", Readline.completion_append_character)
+ Readline.completion_append_character = nil
+ assert_equal(nil, Readline.completion_append_character)
+ Readline.completion_append_character = ""
+ assert_equal(nil, Readline.completion_append_character)
+ rescue NotImplementedError
+ end
end
private