@@ -4,7 +4,6 @@ use std::io::{BufRead, BufReader};
4
4
5
5
use camino:: { Utf8Path , Utf8PathBuf } ;
6
6
7
- use crate :: common:: Config ;
8
7
use crate :: runtest:: ProcRes ;
9
8
10
9
/// Representation of information to invoke a debugger and check its output
@@ -20,11 +19,7 @@ pub(super) struct DebuggerCommands {
20
19
}
21
20
22
21
impl DebuggerCommands {
23
- pub fn parse_from (
24
- file : & Utf8Path ,
25
- config : & Config ,
26
- debugger_prefix : & str ,
27
- ) -> Result < Self , String > {
22
+ pub fn parse_from ( file : & Utf8Path , debugger_prefix : & str ) -> Result < Self , String > {
28
23
let command_directive = format ! ( "{debugger_prefix}-command" ) ;
29
24
let check_directive = format ! ( "{debugger_prefix}-check" ) ;
30
25
@@ -47,14 +42,10 @@ impl DebuggerCommands {
47
42
continue ;
48
43
} ;
49
44
50
- if let Some ( command) =
51
- config. parse_name_value_directive ( & line, & command_directive, file, line_no)
52
- {
45
+ if let Some ( command) = parse_name_value ( & line, & command_directive) {
53
46
commands. push ( command) ;
54
47
}
55
- if let Some ( pattern) =
56
- config. parse_name_value_directive ( & line, & check_directive, file, line_no)
57
- {
48
+ if let Some ( pattern) = parse_name_value ( & line, & check_directive) {
58
49
check_lines. push ( ( line_no, pattern) ) ;
59
50
}
60
51
}
@@ -114,6 +105,18 @@ impl DebuggerCommands {
114
105
}
115
106
}
116
107
108
+ /// Split off from the main `parse_name_value_directive`, so that improvements
109
+ /// to directive handling aren't held back by debuginfo test commands.
110
+ fn parse_name_value ( line : & str , name : & str ) -> Option < String > {
111
+ if let Some ( after_name) = line. strip_prefix ( name)
112
+ && let Some ( value) = after_name. strip_prefix ( ':' )
113
+ {
114
+ Some ( value. to_owned ( ) )
115
+ } else {
116
+ None
117
+ }
118
+ }
119
+
117
120
/// Check that the pattern in `check_line` applies to `line`. Returns `true` if they do match.
118
121
fn check_single_line ( line : & str , check_line : & str ) -> bool {
119
122
// Allow check lines to leave parts unspecified (e.g., uninitialized
0 commit comments