nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: oxc-project/oxc-resolver
Pull request #148 (2024-04-24 16:26:42)

refactor: remove `PartialEq` and `Eq` from `Specifier`


Patch:
diff --git a/src/specifier.rs b/src/specifier.rs
index 28fe4e4..3d35eaf 100644
--- a/src/specifier.rs
+++ b/src/specifier.rs
@@ -1,7 +1,7 @@
 use crate::error::SpecifierError;
 use std::borrow::Cow;
 
-#[derive(Debug, Eq, PartialEq)]
+#[derive(Debug)]
 pub struct Specifier<'a> {
     path: Cow<'a, str>,
     pub query: Option<&'a str>,
@@ -82,14 +82,21 @@ impl<'a> Specifier<'a> {
 mod tests {
     use super::{Specifier, SpecifierError};
 
+    #[test]
+    fn debug() {
+        let specifier = Specifier::parse("/").unwrap();
+        assert_eq!(
+            format!("{specifier:?}"),
+            r#"Specifier { path: "/", query: None, fragment: None }"#
+        );
+    }
+
     #[test]
     fn empty() {
         let specifiers = ["", "?"];
         for specifier in specifiers {
-            assert_eq!(
-                Specifier::parse(specifier),
-                Err(SpecifierError::Empty(specifier.to_string()))
-            );
+            let error = Specifier::parse(specifier).unwrap_err();
+            assert_eq!(error, SpecifierError::Empty(specifier.to_string()));
         }
     }
 


Test patch:
diff --git a/src/tests/tsconfig_paths.rs b/src/tests/tsconfig_paths.rs
index 9e92bf8..78beb5c 100644
--- a/src/tests/tsconfig_paths.rs
+++ b/src/tests/tsconfig_paths.rs
@@ -4,7 +4,9 @@
 
 use std::path::{Path, PathBuf};
 
-use crate::{ResolveOptions, Resolver, TsConfig, TsconfigOptions, TsconfigReferences};
+use crate::{
+    ResolveError, ResolveOptions, Resolver, TsConfig, TsconfigOptions, TsconfigReferences,
+};
 
 // <https://github.com/parcel-bundler/parcel/blob/b6224fd519f95e68d8b93ba90376fd94c8b76e69/packages/utils/node-resolver-rs/src/lib.rs#L2303>
 #[test]
@@ -56,6 +58,22 @@ fn tsconfig() {
     }
 }
 
+#[test]
+fn tsconfig_fallthrough() {
+    let f = super::fixture_root().join("tsconfig");
+
+    let resolver = Resolver::new(ResolveOptions {
+        tsconfig: Some(TsconfigOptions {
+            config_file: f.join("tsconfig.json"),
+            references: TsconfigReferences::Auto,
+        }),
+        ..ResolveOptions::default()
+    });
+
+    let resolved_path = resolver.resolve(&f, "/");
+    assert_eq!(resolved_path, Err(ResolveError::NotFound("/".into())));
+}
+
 #[test]
 fn json_with_comments() {
     let f = super::fixture_root().join("tsconfig/cases/trailing-comma");