summaryrefslogtreecommitdiff
path: root/test/reline/yamatanooroti/test_rendering.rb
blob: c7e0ed4806e453c632d418e04555b0ac59f10dbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'reline'

begin
  require 'yamatanooroti'

  class Reline::TestRendering < Yamatanooroti::TestCase
    def setup
      inputrc_backup = ENV['INPUTRC']
      ENV['INPUTRC'] = 'nonexistent_file'
      start_terminal(5, 30, %w{ruby -Ilib bin/multiline_repl})
      sleep 0.5
      ENV['INPUTRC'] = inputrc_backup
    end

    def test_history_back
      write(":a\n")
      write("\C-p")
      close
      assert_screen(<<~EOC)
        Multiline REPL.
        prompt> :a
        => :a
        prompt> :a
      EOC
    end

    def test_backspace
      write(":abc\C-h\n")
      close
      assert_screen(<<~EOC)
        Multiline REPL.
        prompt> :ab
        => :ab
        prompt>
      EOC
    end
  end
rescue LoadError, NameError # yamatanooroti gem not found
end