rhysd/tui-textarea

Update code in README to compile to enable unit testing

joshka opened this issue · 2 comments

joshka commented

The code in the README does not compile, which is fine generally, but is imported into lib.rs, which causes cargo test not to run (and which precludes writing unit tests easily).

Some ideas on fixing this:

  1. Update all the readme code to be complete (including the various imports necessary to run the code).
  2. Tag each code sample in the readme as ignore to avoid including it in the tests run by cargo test
  3. Move most of the readme to lib.rs and use cargo-rdme to keep things in sync instead of including the readme in lib.rs (and then fix the code samples there instead)

Personally I like option 3, but option 2 might be a quick short term solution.

rhysd commented

Thanks for the point. For now, please add --skip as contribution guide says.

The first option is not acceptable because it makes code blocks in document bigger.

The second option is not acceptable because it loses syntax highlighting of code blocks.

The third option looks the best in those three. I don't want to use additional 3rd party tool as much as possible only for managing readme file, but I'll try the tool.

rhysd commented

I learned that rust,ignore code block works fine in both README.md and lib.rs.

```rust,ignore
...
```