Skip to content

Commit

Permalink
rustlings 100 done
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jul 8, 2024
1 parent 4c3c149 commit ee0a8f2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
7 changes: 7 additions & 0 deletions exercises/tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions exercises/tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "tests7"
version = "0.0.1"
edition = "2021"
[[bin]]
name = "tests7"
path = "tests7.rs"
5 changes: 2 additions & 3 deletions exercises/tests/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! This is the build script for both tests7 and tests8.
//!
//! You should modify this file to make both exercises pass.
fn main() {
// In tests7, we should set up an environment variable
// called `TEST_FOO`. Print in the standard output to let
Expand All @@ -11,14 +10,14 @@ fn main() {
.unwrap()
.as_secs(); // What's the use of this timestamp here?
let your_command = format!(
"Your command here with {}, please checkout exercises/tests/build.rs",
"rustc-env=TEST_FOO=",
timestamp
);
println!("cargo:{}", your_command);

// In tests8, we should enable "pass" feature to make the
// testcase return early. Fill in the command to tell
// Cargo about that.
let your_command = "Your command here, please checkout exercises/tests/build.rs";
let your_command = "rustc-cfg=pass";
println!("cargo:{}", your_command);
}
1 change: 0 additions & 1 deletion exercises/tests/tests7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
// Execute `rustlings hint tests7` or use the `hint` watch subcommand for a
// hint.

// I AM NOT DONE

fn main() {}

Expand Down
1 change: 0 additions & 1 deletion exercises/tests/tests8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
// Execute `rustlings hint tests8` or use the `hint` watch subcommand for a
// hint.

// I AM NOT DONE

fn main() {}

Expand Down
4 changes: 2 additions & 2 deletions exercises/tests/tests9.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
//
// You should NOT modify any existing code except for adding two lines of attributes.

// I AM NOT DONE

extern "Rust" {
fn my_demo_function(a: u32) -> u32;
#[link_name = "my_demo_function"]
fn my_demo_function_alias(a: u32) -> u32;
}

mod Foo {
// No `extern` equals `extern "Rust"`.
#[no_mangle]
fn my_demo_function(a: u32) -> u32 {
a
}
Expand Down

0 comments on commit ee0a8f2

Please sign in to comment.