summaryrefslogtreecommitdiff
path: root/rust/hello
diff options
context:
space:
mode:
authorCarlos Maiolino <[email protected]>2025-09-06 09:30:39 +0200
committerCarlos Maiolino <[email protected]>2025-09-06 09:35:00 +0200
commitee8a08bfa24d9a3d09273fdebe8d73ac38c545f9 (patch)
tree856c1a6347bea7f29bf2048c8f2028e5a3e656ef /rust/hello
parent93b1c04a218858ecc59b6b8929103695b7b8c2a0 (diff)
Update guessing game
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'rust/hello')
-rw-r--r--rust/hello/Cargo.lock128
-rw-r--r--rust/hello/Cargo.toml7
-rw-r--r--rust/hello/false.corebin0 -> 12189696 bytes
-rw-r--r--rust/hello/src/bin/false.rs4
-rw-r--r--rust/hello/src/bin/true.rs3
-rw-r--r--rust/hello/src/main.rs3
-rw-r--r--rust/hello/tests/.cli.rs.un~bin0 -> 1045 bytes
-rw-r--r--rust/hello/tests/cli.rs19
-rw-r--r--rust/hello/tests/cli.rs~19
9 files changed, 183 insertions, 0 deletions
diff --git a/rust/hello/Cargo.lock b/rust/hello/Cargo.lock
new file mode 100644
index 0000000..577ea0a
--- /dev/null
+++ b/rust/hello/Cargo.lock
@@ -0,0 +1,128 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "assert_cmd"
+version = "1.0.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c98233c6673d8601ab23e77eb38f999c51100d46c5703b17288c57fddf3a1ffe"
+dependencies = [
+ "bstr",
+ "doc-comment",
+ "predicates",
+ "predicates-core",
+ "predicates-tree",
+ "wait-timeout",
+]
+
+[[package]]
+name = "bstr"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
+dependencies = [
+ "lazy_static",
+ "memchr",
+ "regex-automata",
+]
+
+[[package]]
+name = "difflib"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
+
+[[package]]
+name = "doc-comment"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
+
+[[package]]
+name = "either"
+version = "1.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
+
+[[package]]
+name = "hello"
+version = "0.1.0"
+dependencies = [
+ "assert_cmd",
+]
+
+[[package]]
+name = "itertools"
+version = "0.10.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
+dependencies = [
+ "either",
+]
+
+[[package]]
+name = "lazy_static"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
+
+[[package]]
+name = "libc"
+version = "0.2.174"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
+
+[[package]]
+name = "memchr"
+version = "2.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
+
+[[package]]
+name = "predicates"
+version = "2.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd"
+dependencies = [
+ "difflib",
+ "itertools",
+ "predicates-core",
+]
+
+[[package]]
+name = "predicates-core"
+version = "1.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa"
+
+[[package]]
+name = "predicates-tree"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c"
+dependencies = [
+ "predicates-core",
+ "termtree",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
+
+[[package]]
+name = "termtree"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683"
+
+[[package]]
+name = "wait-timeout"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11"
+dependencies = [
+ "libc",
+]
diff --git a/rust/hello/Cargo.toml b/rust/hello/Cargo.toml
new file mode 100644
index 0000000..6f29c28
--- /dev/null
+++ b/rust/hello/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "hello"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
+assert_cmd = "1"
diff --git a/rust/hello/false.core b/rust/hello/false.core
new file mode 100644
index 0000000..8f68c3a
--- /dev/null
+++ b/rust/hello/false.core
Binary files differ
diff --git a/rust/hello/src/bin/false.rs b/rust/hello/src/bin/false.rs
new file mode 100644
index 0000000..a0d6817
--- /dev/null
+++ b/rust/hello/src/bin/false.rs
@@ -0,0 +1,4 @@
+fn main() {
+ //std::process::exit(1);
+ std::process::abort();
+}
diff --git a/rust/hello/src/bin/true.rs b/rust/hello/src/bin/true.rs
new file mode 100644
index 0000000..44490fa
--- /dev/null
+++ b/rust/hello/src/bin/true.rs
@@ -0,0 +1,3 @@
+fn main() {
+ std::process::exit(0);
+}
diff --git a/rust/hello/src/main.rs b/rust/hello/src/main.rs
new file mode 100644
index 0000000..e7a11a9
--- /dev/null
+++ b/rust/hello/src/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+ println!("Hello, world!");
+}
diff --git a/rust/hello/tests/.cli.rs.un~ b/rust/hello/tests/.cli.rs.un~
new file mode 100644
index 0000000..9dee229
--- /dev/null
+++ b/rust/hello/tests/.cli.rs.un~
Binary files differ
diff --git a/rust/hello/tests/cli.rs b/rust/hello/tests/cli.rs
new file mode 100644
index 0000000..a69010f
--- /dev/null
+++ b/rust/hello/tests/cli.rs
@@ -0,0 +1,19 @@
+use assert_cmd::Command;
+
+#[test]
+fn runs() {
+ let mut cmd = Command::cargo_bin("hello").unwrap();
+ cmd.assert().success().stdout("Hello, world!\n");
+}
+
+#[test]
+fn true_ok() {
+ let mut cmd = Command::cargo_bin("true").unwrap();
+ cmd.assert().success();
+}
+
+#[test]
+fn false_not_ok() {
+ let mut cmd = Command::cargo_bin("false").unwrap();
+ cmd.assert().failure();
+}
diff --git a/rust/hello/tests/cli.rs~ b/rust/hello/tests/cli.rs~
new file mode 100644
index 0000000..57bbfdf
--- /dev/null
+++ b/rust/hello/tests/cli.rs~
@@ -0,0 +1,19 @@
+use assert_cmd::Command;
+
+#[test]
+fn runs() {
+ let mut cmd = Command::cargo_bin("hello").unwrap();
+ cmd.assert().success().stdout("Hello, world!!\n");
+}
+
+#[test]
+fn true_ok() {
+ let mut cmd = Command::cargo_bin("true").unwrap();
+ cmd.assert().success();
+}
+
+#[test]
+fn false_not_ok() {
+ let mut cmd = Command::cargo_bin("false").unwrap();
+ cmd.assert().failure();
+}