summaryrefslogtreecommitdiff
path: root/cli/tools/test/fmt.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-10-05 11:25:15 +0100
committerGitHub <noreply@github.com>2023-10-05 11:25:15 +0100
commit551a08145098e95022efb778308d677db60a67cc (patch)
tree1ea66cdf7066a9e7e3229a1b97ac9ad4f50bbd06 /cli/tools/test/fmt.rs
parentfd4fc2d81830c8350ccdc7be689db31183ada235 (diff)
refactor(test): support custom writer in PrettyTestReporter (#20783)
Diffstat (limited to 'cli/tools/test/fmt.rs')
-rw-r--r--cli/tools/test/fmt.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/cli/tools/test/fmt.rs b/cli/tools/test/fmt.rs
index d7b357a4b..148b5845c 100644
--- a/cli/tools/test/fmt.rs
+++ b/cli/tools/test/fmt.rs
@@ -3,7 +3,9 @@
use super::*;
pub fn to_relative_path_or_remote_url(cwd: &Url, path_or_url: &str) -> String {
- let url = Url::parse(path_or_url).unwrap();
+ let Ok(url) = Url::parse(path_or_url) else {
+ return "<anonymous>".to_string();
+ };
if url.scheme() == "file" {
if let Some(mut r) = cwd.make_relative(&url) {
if !r.starts_with("../") {