File: irb_test.rb

package info (click to toggle)
ruby-byebug 11.1.3-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,252 kB
  • sloc: ruby: 8,835; ansic: 1,662; sh: 6; makefile: 4
file content (40 lines) | stat: -rw-r--r-- 844 bytes parent folder | download | duplicates (3)
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
40
# frozen_string_literal: true

require "test_helper"
require "minitest/mock"

module Byebug
  #
  # Tests entering IRB from within Byebug.
  #
  class IrbTest < TestCase
    def program
      strip_line_numbers <<-RUBY
        1:  module Byebug
        2:    byebug
        3:
        4:    a = 2
        5:    a + 4
        6:  end
      RUBY
    end

    def test_irb_command_starts_an_irb_session
      interface.stub(:instance_of?, true) do
        assert_calls(IRB, :start) do
          enter "irb"
          debug_code(minimal_program)
        end
      end
    end

    def test_autoirb_calls_irb_automatically_after_every_stop
      interface.stub(:instance_of?, true) do
        assert_calls(IRB, :start) do
          enter "set autoirb", "cont 5", "set noautoirb"
          debug_code(program)
        end
      end
    end
  end
end