@@ -67,45 +67,55 @@ def build_and_run_until_breakpoint(self):
67
67
def verify_frames_source (
68
68
self , frames , main_frame_assembly : bool , other_frame_assembly : bool
69
69
):
70
+ self .assertLessEqual (2 , len (frames ), "expect at least 2 frames" )
71
+ source_0 = frames [0 ].get ("source" )
72
+ source_1 = frames [1 ].get ("source" )
73
+ self .assertIsNotNone (source_0 , "Expects a source object in frame 0" )
74
+ self .assertIsNotNone (source_1 , "Expects a source object in frame 1" )
75
+
76
+ # it does not always have a path.
77
+ source_0_path : str = source_0 .get ("path" , "" )
78
+ source_1_path : str = source_1 .get ("path" , "" )
79
+
70
80
if other_frame_assembly :
71
81
self .assertFalse (
72
- frames [ 0 ][ "source" ][ "path" ] .endswith ("other.c" ),
82
+ source_0_path .endswith ("other.c" ),
73
83
"Expect original source path to not be in unavailable source frame (other.c)" ,
74
84
)
75
85
self .assertIn (
76
86
"sourceReference" ,
77
- frames [ 0 ][ "source" ] ,
87
+ source_0 ,
78
88
"Expect sourceReference to be in unavailable source frame (other.c)" ,
79
89
)
80
90
else :
81
91
self .assertTrue (
82
- frames [ 0 ][ "source" ][ "path" ] .endswith ("other.c" ),
92
+ source_0_path .endswith ("other.c" ),
83
93
"Expect original source path to be in normal source frame (other.c)" ,
84
94
)
85
95
self .assertNotIn (
86
96
"sourceReference" ,
87
- frames [ 0 ][ "source" ] ,
97
+ source_0 ,
88
98
"Expect sourceReference to not be in normal source frame (other.c)" ,
89
99
)
90
100
91
101
if main_frame_assembly :
92
102
self .assertFalse (
93
- frames [ 1 ][ "source" ][ "path" ] .endswith ("main.c" ),
103
+ source_1_path .endswith ("main.c" ),
94
104
"Expect original source path to not be in unavailable source frame (main.c)" ,
95
105
)
96
106
self .assertIn (
97
107
"sourceReference" ,
98
- frames [ 1 ][ "source" ] ,
108
+ source_1 ,
99
109
"Expect sourceReference to be in unavailable source frame (main.c)" ,
100
110
)
101
111
else :
102
112
self .assertTrue (
103
- frames [ 1 ][ "source" ][ "path" ] .endswith ("main.c" ),
113
+ source_1_path .endswith ("main.c" ),
104
114
"Expect original source path to be in normal source frame (main.c)" ,
105
115
)
106
116
self .assertNotIn (
107
117
"sourceReference" ,
108
- frames [ 1 ][ "source" ] ,
118
+ source_1 ,
109
119
"Expect sourceReference to not be in normal source code frame (main.c)" ,
110
120
)
111
121
0 commit comments