- Notifications
You must be signed in to change notification settings - Fork 6.2k
Fix for debugging Go subtests #43849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix for debugging Go subtests #43849
Conversation
| We require contributors to sign our Contributor License Agreement, and we don't have @kyegupov on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
36e8c3c to 855fa61 Compare | We require contributors to sign our Contributor License Agreement, and we don't have @kyegupov on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
| @cla-bot check |
| We require contributors to sign our Contributor License Agreement, and we don't have @kyegupov on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
| The cla-bot has been summoned, and re-checked this pull request! |
| @cla-bot check |
| The cla-bot has been summoned, and re-checked this pull request! |
| // Finish the old single-quoted sequence, add "\'", start a new single-quoted sequence | ||
| const SINGLE_QUOTE_QUOTED_IN_SINGLE_QUOTED_STRING: &str = "'\\''"; | ||
| | ||
| /// Quotes an argument (e.g. a test name) for use in a shell command. | ||
| /// Using the single-quote technique described in https://stackoverflow.com/a/20053121: | ||
| /// `It's a "string"` => `'It'\''s a "string"'` | ||
| pub fn quote_arg(name: &str) -> String { | ||
| let mut quoted = "'".to_string(); | ||
| for c in name.chars() { | ||
| if c == '\'' { | ||
| quoted.push_str(SINGLE_QUOTE_QUOTED_IN_SINGLE_QUOTED_STRING); | ||
| } else { | ||
| quoted.push(c); | ||
| } | ||
| } | ||
| quoted.push('\''); | ||
| quoted | ||
| } | ||
| | ||
| /// Unquotes an argument previously quoted via `quote_arg`. | ||
| pub fn unquote_arg(name: &str) -> String { | ||
| if name.starts_with('\'') && name.ends_with('\'') { | ||
| return name[1..name.len() - 1].replace(SINGLE_QUOTE_QUOTED_IN_SINGLE_QUOTED_STRING, "'"); | ||
| } | ||
| // If this condition above not true, it's suspicious, since this function should be called only | ||
| // on strings that are known to be quoted. | ||
| // However, it should be safe to fall back to the original string (the result of this function | ||
| // is supposed to be "unsafe" for raw shell usage anyway). | ||
| name.to_string() | ||
| } | ||
| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this is expecting unix shell escape characters and doesn't handle any shells for Window's. Could you make this non OS specific please?
Closes #43847
The problem is the quote fix #42734 was:
Release Notes: