зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-09-07 16:05:50 +03:00
fix contributing guide and clippy warnings in tests
Этот коммит содержится в:
@@ -1,3 +1,3 @@
|
|||||||
[alias]
|
[alias]
|
||||||
watch-check = ["watch", "-x", "check --examples --features ratatui-crossterm,search --no-default-features --tests", "-x", "check --examples --features search --tests"]
|
watch-check = ["watch", "-x", "clippy --features ratatui-crossterm,search --no-default-features --examples --tests", "-x", "clippy --features search --examples --tests"]
|
||||||
watch-test = ["watch", "-x", "test --features=search -- --skip=src/lib.rs", "-w", "src"]
|
watch-test = ["watch", "-x", "test --features=search -- --skip=src/lib.rs", "-w", "src", "-w", "tests"]
|
||||||
|
|||||||
@@ -29,13 +29,15 @@ cargo test --features=search -- --skip src/lib.rs
|
|||||||
To run linters:
|
To run linters:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cargo clippy --all-features --examples
|
cargo clippy --features=search --tests --examples
|
||||||
|
cargo clippy --features=ratatui-crossterm,search --no-default-features --tests --examples
|
||||||
cargo fmt -- --check
|
cargo fmt -- --check
|
||||||
```
|
```
|
||||||
|
|
||||||
If you use [cargo-watch][], `cargo watch-check` alias is useful to run checks automatically on writing to a file.
|
If you use [cargo-watch][], `cargo watch-check` and `cargo watch-test` aliases are useful to run checks/tests automatically
|
||||||
|
on writing to a file.
|
||||||
|
|
||||||
## Print debug
|
## Print debugging
|
||||||
|
|
||||||
Since this crate uses stdout, `println!` is not available for debugging. Instead, stderr through [`eprintln!`][eprintln]
|
Since this crate uses stdout, `println!` is not available for debugging. Instead, stderr through [`eprintln!`][eprintln]
|
||||||
or [`dbg!`][dbg] are useful.
|
or [`dbg!`][dbg] are useful.
|
||||||
|
|||||||
@@ -673,7 +673,7 @@ This project is developed [on GitHub][repo].
|
|||||||
For feature requests or bug reports, please [create an issue][new-issue]. For submitting patches, please [create a pull
|
For feature requests or bug reports, please [create an issue][new-issue]. For submitting patches, please [create a pull
|
||||||
request][pulls].
|
request][pulls].
|
||||||
|
|
||||||
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) before making a PR.
|
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) before reporting an issue or making a PR.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
@@ -332,14 +332,14 @@ mod tests {
|
|||||||
use crate::tui::widgets::Widget;
|
use crate::tui::widgets::Widget;
|
||||||
use crate::{CursorMove, TextArea};
|
use crate::{CursorMove, TextArea};
|
||||||
|
|
||||||
let mut textarea: TextArea = (0..20).into_iter().map(|i| i.to_string()).collect();
|
let mut textarea: TextArea = (0..20).map(|i| i.to_string()).collect();
|
||||||
let r = Rect {
|
let r = Rect {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 8,
|
height: 8,
|
||||||
};
|
};
|
||||||
let mut b = Buffer::empty(r.clone());
|
let mut b = Buffer::empty(r);
|
||||||
textarea.widget().render(r, &mut b);
|
textarea.widget().render(r, &mut b);
|
||||||
|
|
||||||
textarea.move_cursor(CursorMove::Bottom);
|
textarea.move_cursor(CursorMove::Bottom);
|
||||||
|
|||||||
@@ -193,14 +193,14 @@ mod tests {
|
|||||||
use crate::tui::widgets::Widget;
|
use crate::tui::widgets::Widget;
|
||||||
use crate::TextArea;
|
use crate::TextArea;
|
||||||
|
|
||||||
let mut textarea: TextArea = (0..20).into_iter().map(|i| i.to_string()).collect();
|
let mut textarea: TextArea = (0..20).map(|i| i.to_string()).collect();
|
||||||
let r = Rect {
|
let r = Rect {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 8,
|
height: 8,
|
||||||
};
|
};
|
||||||
let mut b = Buffer::empty(r.clone());
|
let mut b = Buffer::empty(r);
|
||||||
textarea.widget().render(r, &mut b);
|
textarea.widget().render(r, &mut b);
|
||||||
|
|
||||||
textarea.scroll(Scrolling::Delta { rows: 2, cols: 0 });
|
textarea.scroll(Scrolling::Delta { rows: 2, cols: 0 });
|
||||||
|
|||||||
@@ -1690,14 +1690,14 @@ mod tests {
|
|||||||
use crate::tui::layout::Rect;
|
use crate::tui::layout::Rect;
|
||||||
use crate::tui::widgets::Widget;
|
use crate::tui::widgets::Widget;
|
||||||
|
|
||||||
let mut textarea: TextArea = (0..20).into_iter().map(|i| i.to_string()).collect();
|
let mut textarea: TextArea = (0..20).map(|i| i.to_string()).collect();
|
||||||
let r = Rect {
|
let r = Rect {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 8,
|
height: 8,
|
||||||
};
|
};
|
||||||
let mut b = Buffer::empty(r.clone());
|
let mut b = Buffer::empty(r);
|
||||||
textarea.widget().render(r, &mut b);
|
textarea.widget().render(r, &mut b);
|
||||||
|
|
||||||
textarea.scroll((15, 0));
|
textarea.scroll((15, 0));
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user