@@ -4,7 +4,7 @@ use std::io::{BufRead, BufReader};
44
55use camino:: { Utf8Path , Utf8PathBuf } ;
66
7- use crate :: directives:: LineNumber ;
7+ use crate :: directives:: { LineNumber , line_directive } ;
88use crate :: runtest:: ProcRes ;
99
1010/// Representation of information to invoke a debugger and check its output
@@ -37,15 +37,19 @@ impl DebuggerCommands {
3737 continue ;
3838 }
3939
40- let Some ( line ) = line . trim_start ( ) . strip_prefix ( "//@" ) . map ( str :: trim_start ) else {
40+ let Some ( directive ) = line_directive ( file , line_number , & line ) else {
4141 continue ;
4242 } ;
4343
44- if let Some ( command) = parse_name_value ( & line, & command_directive) {
45- commands. push ( command) ;
44+ if directive. name == command_directive
45+ && let Some ( command) = directive. value_after_colon ( )
46+ {
47+ commands. push ( command. to_string ( ) ) ;
4648 }
47- if let Some ( pattern) = parse_name_value ( & line, & check_directive) {
48- check_lines. push ( ( line_number, pattern) ) ;
49+ if directive. name == check_directive
50+ && let Some ( pattern) = directive. value_after_colon ( )
51+ {
52+ check_lines. push ( ( line_number, pattern. to_string ( ) ) ) ;
4953 }
5054 }
5155
@@ -103,18 +107,6 @@ impl DebuggerCommands {
103107 }
104108}
105109
106- /// Split off from the main `parse_name_value_directive`, so that improvements
107- /// to directive handling aren't held back by debuginfo test commands.
108- fn parse_name_value ( line : & str , name : & str ) -> Option < String > {
109- if let Some ( after_name) = line. strip_prefix ( name)
110- && let Some ( value) = after_name. strip_prefix ( ':' )
111- {
112- Some ( value. to_owned ( ) )
113- } else {
114- None
115- }
116- }
117-
118110/// Check that the pattern in `check_line` applies to `line`. Returns `true` if they do match.
119111fn check_single_line ( line : & str , check_line : & str ) -> bool {
120112 // Allow check lines to leave parts unspecified (e.g., uninitialized
0 commit comments