Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/timothystiles/hello-rs

A starter rust project with code coverage gutters in vs code via extensions.
https://github.com/timothystiles/hello-rs

code-coverage code-highlighter github-actions on-save rust test-automation test-driven-development testing vscode

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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](https://github.com/bebop/poly) covered by tests being highlighted green.](./screenshots/golang-gutters.png)

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.](./screenshots/rust-gutters.png)

If you want to know more about how code coverage works in Rust, check out the [official docs](https://doc.rust-lang.org/rustc/instrument-coverage.html).

## Install

This assumes you already have `rustc` and `cargo` installed. If you don't, you can install them with [rustup](https://rustup.rs/).

```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
* [hello-ts](https://github.com/TimothyStiles/hello-ts) (typescript)

## Sponsor

* **[Sponsor](https://github.com/sponsors/TimothyStiles):** 🤘 Thanks for your support 🤘

## License

* [MIT](LICENSE)

* Copyright (c) 2023 Timothy Stiles