class TestHistory

Public Instance Methods

test_history_arg_extract() click to toggle source

RbReadline::HISTORY_WORD_DELIMITERS.inspect

> “ tn;&()|<>”

RbReadline::HISTORY_QUOTE_CHARACTERS = “"'`”

> “"'`”

# File test/test_history.rb, line 10
def test_history_arg_extract
  assert_raises(RuntimeError) { RbReadline.history_arg_extract("!", "$", "one two three") }
  assert_raises(RuntimeError) { RbReadline.history_arg_extract("$", "!", "one two three") }

  assert_equal "one", RbReadline.history_arg_extract("$", "$", "one")
  assert_equal "three", RbReadline.history_arg_extract("$", "$", "one two three")
  assert_equal "two\\ three", RbReadline.history_arg_extract("$", "$", "one two\\ three")
  assert_equal "three", RbReadline.history_arg_extract("$", "$", "one two;three")
  assert_equal "two\\;three", RbReadline.history_arg_extract("$", "$", "one two\\;three")

  assert_equal "'two three'", RbReadline.history_arg_extract("$", "$", "one 'two three'")
  assert_equal "`two three`", RbReadline.history_arg_extract("$", "$", "one `two three`")
  assert_equal "three\\'", RbReadline.history_arg_extract("$", "$", "one \\'two three\\'")
  assert_equal "`one`", RbReadline.history_arg_extract("$", "$", "`one`")

  assert_equal "three'", RbReadline.history_arg_extract("$", "$", "one two three'")
  assert_equal "three", RbReadline.history_arg_extract("$", "$", "one two' three")
  assert_equal "'two three '", RbReadline.history_arg_extract("$", "$", "one 'two three '")
end