Skip to content

Latest commit

 

History

History
110 lines (75 loc) · 2.97 KB

CONTRIBUTING.md

File metadata and controls

110 lines (75 loc) · 2.97 KB

Reporting an issue

For reporting a bug, please make sure your report includes the following points.

  • How to reproduce it
    • What text the textarea contained as pre-condition
    • What operations you did
    • What was the expected behavior
    • What was the actual behavior
  • Environment
    • Your terminal
    • Rust version
    • ratatui or tui crate version
    • Enabled features of tui-textarea crate

An example of bug report: #1

Submitting a pull request

Please ensure that all tests and linter checks passed on your branch before creating a PR which modifies some source files.

To run tests:

cargo test --features=search

To run linters:

cargo clippy --features=search,termwiz,termion --tests --examples
cargo clippy --features=tuirs-crossterm,tuirs-termion,search --no-default-features --tests --examples
cargo fmt -- --check

Note: On Windows, remove termion and tuirs-termion features from --features argument since termion doesn't support Windows.

If you use cargo-watch, cargo watch-check and cargo watch-test aliases are useful to run checks/tests automatically on files being changed.

Code coverage

Code coverage is monitored on codecov.

https://app.codecov.io/gh/rhysd/tui-textarea

When you implement some new feature, consider to add new unit tests which cover your implementation.

Print debugging

Since this crate uses stdout, println! is not available for debugging. Instead, stderr through eprintln! or dbg! are useful.

At first, add prints where you want to debug:

eprintln!("some value is {:?}", some_value);
dbg!(&some_value);

Then redirect stderr to some file:

cargo run --example minimal 2>debug.txt

Then the debug prints are output to the debug.txt file. If timing is important or you want to see the output in real-time, it would be useful to monitor the file content with tail command in another terminal window.

# In a terminal, reproduce the issue
cargo run --example minimal 2>debug.txt

# In another terminal, run `tail` command to monitor the content
tail -F debug.txt

Running a fuzzer

To run fuzzing tests, cargo-fuzz and Rust nightly toolchain are necessary.

# Show list of fuzzing targets
cargo +nightly fuzz list

# Run 'edit' fuzzing test case
cargo +nightly fuzz run edit

Running benchmark suites

Benchmarks are available using Criterion.rs.

To separate criterion crate dependency, benchmark suites are separated as another crate in bench/.

To run benchmarks:

cd ./bench
cargo bench --benches

See README in bench/ for more details.