File tree 1 file changed +58
-0
lines changed
1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../support/console_test_case'
4
+
5
+ module DEBUGGER__
6
+ class WhereamiTest < ConsoleTestCase
7
+ def program
8
+ <<~RUBY
9
+ 1| a = 1
10
+ 2| a = 1
11
+ 3| a = 1
12
+ 4| a = 1
13
+ 5| a = 1
14
+ 6| a = 1
15
+ 7| a = 1
16
+ 8| a = 1
17
+ 9| a = 1
18
+ 10| a = 1
19
+ 11| b = 1
20
+ 12| b = 1
21
+ 13| b = 1
22
+ 14| b = 1
23
+ 15| b = 1
24
+ 16| b = 1
25
+ 17| b = 1
26
+ 18| b = 1
27
+ 19| b = 1
28
+ 20| b = 1
29
+ 21| c = 1
30
+ RUBY
31
+ end
32
+
33
+ def test_whereami_displays_current_frames_code
34
+ debug_code ( program ) do
35
+ type "list"
36
+ type "list"
37
+
38
+ # after 2 list commands, we should advance to the next 10 lines and not able to see the current frame's source
39
+ assert_no_line_text ( /=> 1\| a = 1/ )
40
+ assert_line_text ( /b = 1/ )
41
+
42
+ type "whereami"
43
+
44
+ # with whereami, we should see the current frame's source but have no visual outside the closest 10 lines
45
+ assert_no_line_text ( /b = 1/ )
46
+ assert_line_text ( /=> 1\| a = 1/ )
47
+
48
+ type "list"
49
+
50
+ # list command should work as normal after whereami is executed
51
+ assert_no_line_text ( /b = 1/ )
52
+ assert_line_text ( /c = 1/ )
53
+
54
+ type "continue"
55
+ end
56
+ end
57
+ end
58
+ end
You can’t perform that action at this time.
0 commit comments