TimothyStiles / hello-rs

A starter rust project with code coverage gutters in vs code via extensions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hello-rs

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.

Example screenshot of golang code from poly covered by tests being highlighted green.

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.

Example screenshot of rust code in this repo covered by tests being highlighted green.

If you want to know more about how code coverage works in Rust, check out the official docs.

Install

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:

  1. Install the recommended vs-code extensions through the dialogue that should pop up when you first open the project.
  2. Close out the window
  3. Reopen the project with vs-code and extensions installed.
  4. Open src/main.rs.
  5. Hit command + s

Now src/main.rs should have the code gutters like in the above screenshot.

Other Languages

Sponsor

  • Sponsor: 🤘 Thanks for your support 🤘

License

  • MIT

  • Copyright (c) 2023 Timothy Stiles

About

A starter rust project with code coverage gutters in vs code via extensions.

License:MIT License


Languages

Language:Rust 100.0%