Sha256: 39db17b7dfbb6272fab1fbc2274e15448d91bf2a83f12e69a6e4cc5cd67d3a94

Contents?: true

Size: 1.46 KB

Versions: 9

Compression:

Stored size: 1.46 KB

Contents

require "minitest/autorun"
require "readline"

class TestHistory < Minitest::Test

  # RbReadline::HISTORY_WORD_DELIMITERS.inspect
  # => " \t\n;&()|<>"
  # RbReadline::HISTORY_QUOTE_CHARACTERS   = "\"'`"
  # => "\"'`"
  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
end

Version data entries

9 entries across 9 versions & 4 rubygems

Version Path
chess_engine-0.0.2 vendor/bundle/gems/rb-readline-0.5.5/test/test_history.rb
chess_engine-0.0.1 vendor/bundle/gems/rb-readline-0.5.5/test/test_history.rb
rb-readline-0.5.5 test/test_history.rb
rb-readline-0.5.4 test/test_history.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/rb-readline-0.5.3/test/test_history.rb
rb-readline-0.5.3 test/test_history.rb
rb-readline-r7-0.5.2.0 test/test_history.rb
rb-readline-0.5.2 test/test_history.rb
rb-readline-0.5.1 test/test_history.rb