Skip to content

Commit

Permalink
Auto merge of #14214 - eth3lbert:snapbox-fetch-n-la, r=weihanglo
Browse files Browse the repository at this point in the history
test: migrate fetch and list_availables to snapbox

### What does this PR try to resolve?

Part of #14039.

Migrate following to snapbox:

- `tests/testsuite/fetch.rs`
- `tests/testsuite/list_availables.rs`
  • Loading branch information
bors committed Jul 15, 2024
2 parents 54ee7e3 + 16a2dbd commit 7b227de
Show file tree
Hide file tree
Showing 2 changed files with 883 additions and 122 deletions.
20 changes: 13 additions & 7 deletions tests/testsuite/fetch.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
//! Tests for the `cargo fetch` command.

#![allow(deprecated)]

use cargo_test_support::prelude::*;
use cargo_test_support::registry::Package;
use cargo_test_support::rustc_host;
use cargo_test_support::{basic_manifest, cross_compile, project};
use cargo_test_support::{basic_manifest, cross_compile, project, str};

#[cargo_test]
fn no_deps() {
Expand All @@ -14,7 +12,7 @@ fn no_deps() {
.file("src/a.rs", "")
.build();

p.cargo("fetch").with_stderr("").run();
p.cargo("fetch").with_stderr_data("").run();
}

#[cargo_test]
Expand Down Expand Up @@ -60,11 +58,16 @@ fn fetch_all_platform_dependencies_when_no_target_is_given() {
.build();

p.cargo("fetch")
.with_stderr_contains("[DOWNLOADED] d1 v1.2.3 [..]")
.with_stderr_contains("[DOWNLOADED] d2 v0.1.2 [..]")
.with_stderr_data(str![[r#"
...
[DOWNLOADED] d1 v1.2.3 (registry `dummy-registry`)
[DOWNLOADED] d2 v0.1.2 (registry `dummy-registry`)
...
"#]])
.run();
}

#[allow(deprecated)]
#[cargo_test]
fn fetch_platform_specific_dependencies() {
if cross_compile::disabled() {
Expand Down Expand Up @@ -136,6 +139,9 @@ fn fetch_warning() {
.file("src/lib.rs", "")
.build();
p.cargo("fetch")
.with_stderr("[WARNING] unused manifest key: package.misspelled")
.with_stderr_data(str![[r#"
[WARNING] unused manifest key: package.misspelled
"#]])
.run();
}
Loading

0 comments on commit 7b227de

Please sign in to comment.