@@ -4,7 +4,6 @@ use std::io::{BufRead, BufReader};
44
55use camino:: { Utf8Path , Utf8PathBuf } ;
66
7- use crate :: common:: Config ;
87use crate :: runtest:: ProcRes ;
98
109/// Representation of information to invoke a debugger and check its output
@@ -20,11 +19,7 @@ pub(super) struct DebuggerCommands {
2019}
2120
2221impl 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 > {
2823 let command_directive = format ! ( "{debugger_prefix}-command" ) ;
2924 let check_directive = format ! ( "{debugger_prefix}-check" ) ;
3025
@@ -47,14 +42,10 @@ impl DebuggerCommands {
4742 continue ;
4843 } ;
4944
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) {
5346 commands. push ( command) ;
5447 }
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) {
5849 check_lines. push ( ( line_no, pattern) ) ;
5950 }
6051 }
@@ -114,6 +105,18 @@ impl DebuggerCommands {
114105 }
115106}
116107
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+
117120/// Check that the pattern in `check_line` applies to `line`. Returns `true` if they do match.
118121fn check_single_line ( line : & str , check_line : & str ) -> bool {
119122 // Allow check lines to leave parts unspecified (e.g., uninitialized
0 commit comments