Sha256: 253e3773b90b1045e384671ded3d6170635413bb173dd7fa7e47c546b034562b

Contents?: true

Size: 1.63 KB

Versions: 2

Compression:

Stored size: 1.63 KB

Contents

module Byebug
  class HistoryTestCase < TestCase
    def setup
      @example = -> do
        byebug
        a = 2
        a = 3
      end

      super
    end

    def test_history_displays_latest_records_from_readline_history
      enter 'show', 'history'
      debug_proc(@example)
      check_output_includes("1  show\n    2  history")
    end

    def test_history_n_displays_whole_history_if_n_is_bigger_than_history_size
      enter 'show', 'history 3'
      debug_proc(@example)

      check_output_includes("1  show\n    2  history 3")
    end

    def test_history_n_displays_lastest_n_records_from_readline_history
      enter 'show width', 'show autolist', 'history 2'
      debug_proc(@example)

      check_output_includes("2  show autolist\n    3  history 2")
    end

    def test_history_does_not_save_empty_commands
      enter 'show', 'show width', '', 'history 3'
      debug_proc(@example)

      check_output_includes("1  show\n    2  show width\n    3  history 3")
    end

    def test_history_does_not_save_duplicated_consecutive_commands
      enter 'show', 'show width', 'show width', 'history 3'
      debug_proc(@example)

      check_output_includes("1  show\n    2  show width\n    3  history 3")
    end

    def test_cmds_from_previous_repls_are_remembered_if_autosave_enabled
      enter 'set autosave', 'next', 'history 2'
      debug_proc(@example)

      check_output_includes("2  next\n    3  history 2")
    end

    def test_cmds_from_previous_repls_are_not_remembered_if_autosave_disabled
      enter 'set noautosave', 'next', 'history 2'
      debug_proc(@example)

      check_output_includes("1  history 2")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
byebug-3.5.1 test/commands/history_test.rb
byebug-3.5.0 test/commands/history_test.rb