Skip to content

Commit 6f091b4

Browse files
author
build
committed
feat:exercises
1 parent d8fd7fc commit 6f091b4

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

exercises/tests/Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exercises/tests/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "tests7"
3+
version = "0.0.1"
4+
edition = "2021"
5+
[[bin]]
6+
name = "tests7"
7+
path = "tests7.rs"

exercises/tests/build.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ fn main() {
1010
.duration_since(std::time::UNIX_EPOCH)
1111
.unwrap()
1212
.as_secs(); // What's the use of this timestamp here?
13-
let your_command = format!(
14-
"Your command here with {}, please checkout exercises/tests/build.rs",
15-
timestamp
16-
);
13+
let your_command = format!("rustc-env=TEST_FOO={}", timestamp);
14+
1715
println!("cargo:{}", your_command);
16+
// 告诉 Cargo 当 TEST_FOO 环境变量变化时重新运行构建脚本
17+
println!("cargo:rerun-if-env-changed=TEST_FOO");
1818

1919
// In tests8, we should enable "pass" feature to make the
2020
// testcase return early. Fill in the command to tell

exercises/tests/tests5.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ unsafe fn modify_by_address(address: usize) {
3131
// comment of the test below as your format reference.
3232
unsafe {
3333
let ptr = address as *mut u32;
34-
ptr = 0xAABBCCDD;
34+
*ptr = 0xAABBCCDD;
3535
}
3636
}
3737

temp_13745_ThreadId1

-3.54 MB
Binary file not shown.

0 commit comments

Comments
 (0)