Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/testsuite/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ mod package;
mod patch;
mod path;
mod paths;
mod pkgid;
mod plugins;
mod proc_macro;
mod profile_config;
Expand Down
34 changes: 34 additions & 0 deletions tests/testsuite/pkgid.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//! Tests for the `cargo pkgid` command.
use cargo_test_support::project;
use cargo_test_support::registry::Package;

#[cargo_test]
fn simple() {
Package::new("bar", "0.1.0").publish();
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
edition = "2018"
[dependencies]
bar = "0.1.0"
"#,
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("generate-lockfile").run();

p.cargo("pkgid foo")
.with_stdout(format!("file://[..]{}#0.1.0", p.root().to_str().unwrap()))
.run();

p.cargo("pkgid bar")
.with_stdout("https://github.com/rust-lang/crates.io-index#bar:0.1.0")
.run();
}