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 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
# frozen_string_literal: true
require "test_helper"
module Byebug
#
# Tests displaying values of expressions on every stop.
#
class DisplayTest < TestCase
def program
strip_line_numbers <<-RUBY
1: module Byebug
2: d = 0
3:
4: byebug
5:
6: d += 3
7: d + 6
8: end
RUBY
end
def test_shows_expressions
enter "display d + 1"
debug_code(program) { clear_displays }
check_output_includes "1: d + 1 = 1"
end
def test_shows_undefined_expressions
enter "display e"
debug_code(program) { clear_displays }
check_output_includes "1: e = (undefined)"
end
def test_saves_displayed_expressions
enter "display d + 1"
debug_code(program) do
assert_equal [[true, "d + 1"]], Byebug.displays
clear_displays
end
end
def test_displays_all_expressions_available
enter "display d", "display d + 1", "display"
debug_code(program) { clear_displays }
check_output_includes "1: d = 0", "2: d + 1 = 1"
end
end
end
|