diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:41:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:41:42 +0000 |
commit | 56f5bfd26c333c7f9439bb439861e59e255d3d37 (patch) | |
tree | 1873cff2936f7b3b4abf2ea3c46f78404009af50 /debian/tests/create-and-build-crate | |
parent | Merging upstream version 1.70.0+dfsg2. (diff) | |
download | rustc-56f5bfd26c333c7f9439bb439861e59e255d3d37.tar.xz rustc-56f5bfd26c333c7f9439bb439861e59e255d3d37.zip |
Merging debian version 1.70.0+dfsg2-1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/create-and-build-crate')
-rwxr-xr-x | debian/tests/create-and-build-crate | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/debian/tests/create-and-build-crate b/debian/tests/create-and-build-crate new file mode 100755 index 000000000..46cc2a034 --- /dev/null +++ b/debian/tests/create-and-build-crate @@ -0,0 +1,39 @@ +#!/bin/bash +set -euo pipefail + +tmpdir=$(mktemp -d) +cd "$tmpdir" + +cargo new hello +cd hello + +cat <<EOF > src/main.rs +use anyhow::Result; + +fn main() -> Result<()> { + println!("Hello, World!"); + Ok(()) +} + +#[test] +fn test() { + assert_eq!(1 + 1, 2); +} +EOF + +cargo add 'anyhow@^1' +cargo vendor + +mkdir -p .cargo +cat <<EOF > .cargo/config.toml +[source.crates-io] +replace-with = "vendored-sources" + +[source.vendored-sources] +directory = "vendor" +EOF + +cargo check +cargo build +cargo test +cargo run |