]> git.proxmox.com Git - cargo.git/commitdiff
add test for wrong_case in registry
authorEh2406 <YeomanYaacov@gmail.com>
Tue, 10 Jul 2018 15:05:44 +0000 (11:05 -0400)
committerEh2406 <YeomanYaacov@gmail.com>
Tue, 10 Jul 2018 19:34:04 +0000 (15:34 -0400)
tests/testsuite/registry.rs
tests/testsuite/resolve.rs

index 2b93cbf6e9731ca9a9d43028ce4a68bcd549eb36..af3943d869dfc77507cc36ed07b60abf3a7cbc79 100644 (file)
@@ -161,7 +161,7 @@ fn wrong_case() {
         .file("src/main.rs", "fn main() {}")
         .build();
 
-    // TODO: #5678 to make this work or fleas give better error message
+    // TODO: #5678 to make this work or at least give better error message
     assert_that(
         p.cargo("build"),
         execs().with_status(101).with_stderr(
@@ -195,7 +195,7 @@ fn mis_hyphenated() {
         .file("src/main.rs", "fn main() {}")
         .build();
 
-    // TODO: #2775 to make this work or fleas give better error message
+    // TODO: #2775 to make this work or at least give better error message
     assert_that(
         p.cargo("build"),
         execs().with_status(101).with_stderr(
index 24d5ff9efb026d5e86b8ae46655d9622787426a0..98a0ce972b95d561b486d68567bdf5299806487a 100644 (file)
@@ -440,6 +440,46 @@ fn resolving_incompat_versions() {
     );
 }
 
+#[test]
+fn resolving_wrong_case_from_registry() {
+    // In the future we may #5678 allow this to happen.
+    // For back compatibility reasons, we probably won't.
+    // But we may want to future prove ourselves by understanding it.
+    // This test documents the current behavior.
+    let reg = registry(vec![
+        pkg!(("foo", "1.0.0")),
+        pkg!("bar" => ["Foo"]),
+    ]);
+
+    assert!(
+        resolve(
+            &pkg_id("root"),
+            vec![dep("bar")],
+            &reg
+        ).is_err()
+    );
+}
+
+#[test]
+fn resolving_mis_hyphenated_from_registry() {
+    // In the future we may #2775 allow this to happen.
+    // For back compatibility reasons, we probably won't.
+    // But we may want to future prove ourselves by understanding it.
+    // This test documents the current behavior.
+    let reg = registry(vec![
+        pkg!(("fo-o", "1.0.0")),
+        pkg!("bar" => ["fo_o"]),
+    ]);
+
+    assert!(
+        resolve(
+            &pkg_id("root"),
+            vec![dep("bar")],
+            &reg
+        ).is_err()
+    );
+}
+
 #[test]
 fn resolving_backtrack() {
     let reg = registry(vec![