Skip to content

Commit

Permalink
Added the no_run attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
heisen-li committed May 4, 2023
1 parent ea0d487 commit ff7ff7d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 33 deletions.
3 changes: 2 additions & 1 deletion crates/cargo-test-support/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ use std::path::{Path, PathBuf};

/// Used by `cargo install` tests to assert an executable binary
/// has been installed. Example usage:
///
/// ```no_run
/// use cargo_test_support::install::assert_has_installed_exe;
/// use cargo_test_support::install::cargo_home;
///
/// assert_has_installed_exe(cargo_home(), "foo");
/// ```
#[track_caller]
pub fn assert_has_installed_exe<P: AsRef<Path>>(path: P, name: &'static str) {
assert!(check_has_installed_exe(path, name));
Expand Down
62 changes: 30 additions & 32 deletions crates/cargo-test-support/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,45 +450,43 @@ impl RegistryBuilder {
/// `VendorPackage` which implements directory sources.
///
/// # Example
/// ```
/// ```no_run
/// use cargo_test_support::registry::Package;
/// use cargo_test_support::project;
///
/// fn crate_package_test() {
/// // Publish package "a" depending on "b".
/// Package::new("a", "1.0.0")
/// .dep("b", "1.0.0")
/// .file("src/lib.rs", r#"
/// extern crate b;
/// pub fn f() -> i32 { b::f() * 2 }
/// "#)
/// .publish();
/// // Publish package "a" depending on "b".
/// Package::new("a", "1.0.0")
/// .dep("b", "1.0.0")
/// .file("src/lib.rs", r#"
/// extern crate b;
/// pub fn f() -> i32 { b::f() * 2 }
/// "#)
/// .publish();
///
/// // Publish package "b".
/// Package::new("b", "1.0.0")
/// .file("src/lib.rs", r#"
/// pub fn f() -> i32 { 12 }
/// "#)
/// .publish();
/// // Publish package "b".
/// Package::new("b", "1.0.0")
/// .file("src/lib.rs", r#"
/// pub fn f() -> i32 { 12 }
/// "#)
/// .publish();
///
/// // Create a project that uses package "a".
/// let p = project()
/// .file("Cargo.toml", r#"
/// [package]
/// name = "foo"
/// version = "0.0.1"
/// // Create a project that uses package "a".
/// let p = project()
/// .file("Cargo.toml", r#"
/// [package]
/// name = "foo"
/// version = "0.0.1"
///
/// [dependencies]
/// a = "1.0"
/// "#)
/// .file("src/main.rs", r#"
/// extern crate a;
/// fn main() { println!("{}", a::f()); }
/// "#)
/// .build();
/// [dependencies]
/// a = "1.0"
/// "#)
/// .file("src/main.rs", r#"
/// extern crate a;
/// fn main() { println!("{}", a::f()); }
/// "#)
/// .build();
///
/// p.cargo("run").with_stdout("24").run();
/// }
/// p.cargo("run").with_stdout("24").run();
/// ```
#[must_use]
pub struct Package {
Expand Down

0 comments on commit ff7ff7d

Please sign in to comment.