forked from rust-lang/cargo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
yank.rs
51 lines (43 loc) · 1.19 KB
/
yank.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Tests for the `cargo yank` command.
use std::fs;
use cargo_test_support::paths::CargoPathExt;
use cargo_test_support::project;
use cargo_test_support::registry::{self, api_path, registry_url};
fn setup(name: &str, version: &str) {
let dir = api_path().join(format!("api/v1/crates/{}/{}", name, version));
dir.mkdir_p();
fs::write(dir.join("yank"), r#"{"ok": true}"#).unwrap();
}
#[cargo_test]
fn simple() {
registry::init();
setup("foo", "0.0.1");
let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
version = "0.0.1"
authors = []
license = "MIT"
description = "foo"
"#,
)
.file("src/main.rs", "fn main() {}")
.build();
p.cargo("yank --vers 0.0.1 --index")
.arg(registry_url().to_string())
.run();
p.cargo("yank --undo --vers 0.0.1 --index")
.arg(registry_url().to_string())
.with_status(101)
.with_stderr(
" Updating `[..]` index
Unyank foo:0.0.1
error: failed to undo a yank
Caused by:
EOF while parsing a value at line 1 column 0",
)
.run();
}