hello-rs is a simple example repo to show how you can get started with test driven development in Rust.
Go has in-line running tests, debugging, and code highlighting baked into their official vs-code extension but it turns out most other languages don't have code hightlighting like this by default. This repo shows how you can get started with test driven development in Rust with code highlighting in vs-code.
I was surprised to find that there wasn't a simple way to get code highlighting like this for Rust. I'm sure there are other ways to do this but this is the simplest way I found.
If you want to know more about how code coverage works in Rust, check out the official docs.
This assumes you already have rustc
and cargo
installed. If you don't, you can install them with rustup.
git clone https://github.com/TimothyStiles/hello-rs && cd hello-rs && code .
Then:
- Install the recommended vs-code extensions through the dialogue that should pop up when you first open the project.
- Close out the window
- Reopen the project with vs-code and extensions installed.
- Open
src/main.rs
. - Hit
command + s
Now src/main.rs
should have the code gutters like in the above screenshot.
- hello-ts (typescript)
- Sponsor: 🤘 Thanks for your support 🤘
-
Copyright (c) 2023 Timothy Stiles