feat: cargo + testing

This commit is contained in:
dqnid committed 2025-01-28 17:57:14 +01:00
1 parent 0962166a06
commit 47313f061e
4 files changed
+23

No files matched your search

+1
View File
@@ -2,6 +2,7 @@
name = "rust-by-example"
version = "0.1.0"
edition = "2021"
default-run = "rust-by-example"
[dependencies]
# clap = "2.27.1" # from crates.io
+4
View File
@@ -0,0 +1,4 @@
fn main() {
println!("This was ran with '$ cargo run --bin secondary_main'");
println!("This is a secondary main!");
}
+4
View File
@@ -18,6 +18,10 @@
// mod exercises;
mod concepts;
#[cfg(test)]
#[path = "./test/basic_test.rs"]
mod test;
fn main() {
// helloworld::hello_world_module();
// primitives::primitives_module();
+14
View File
@@ -0,0 +1,14 @@
#[cfg(test)]
pub mod tests {
#[test]
fn test_success() {
let my_hello = "Hello world!";
assert_eq!(my_hello, "Hello world!");
}
#[test]
fn test_failure() {
let my_hello = "ef u world!";
assert_eq!(my_hello, "Hello world!");
}
}