jimlynchcodes-hello-world-rs
v0.0.1
Published
Jim's solution to exercise 01_hello_world of the rust-cli-exercises!
Downloads
1
Maintainers
Readme
Hello, World!
A barebones project that just prints the text "Hello, World"!
Backstory
Imagine you want to make the simplest Rust project possible- just the stuff needed to make a Rust project run.
The idea here is that if you can write a Rust project that compiles, runs, and does something then you can build off this and create all the things you could ever imagine! 🌈
The Exercise
Write the simplest Rust project possible that prints some form of, "Hello, World!" to the console.
Tests
Here I have one maybe pointless unit test just checking that the main function returns nothing.
I also have an integration test which verifies that the text "Hello, world!" is printed to the console and that the prompt appears on a new line.
I'm also adding some other interesting testing tools such as:
Running unit tests with a code coverage output
Running mutation tests to test the unit tests
Running fuzz tests to check for other unexpected behavior
Skills Practiced
Installing and using
cargo
Creating a
main
functionCreating an integration test
Running a Rust project and tests
Dev Commands
Run cli tool locally:
cargo run
Formatting / linting:
cargo fmt
cargo clippy
Run unit & integration tests:
cargo test
Run Units Tests Wih Code Coverage:
cargo tarpaulin
Run Tests Automatically On Code Change (Aka "Watch Mode"):
bacon test
Run Mutation Testing:
cargo mutants
Deploy to Cargo & NPM:
- Increment version in
Cargo.toml
- Sign in with
cargo login
andnpm adduser
Then deploy (with -n flag for a different name):
rust-to-npm-cli deploy -b -n jimlynchcodes/01-hello-world-rs
To install via npm:
npm i -g @jimlynchcodes/hello-world-rs
Then run:
hello-world-rs