+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/uu/ptx/src/ptx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ fn trim_idx(s: &[char], beg: usize, end: usize) -> (usize, usize) {
while b < e && s[b].is_whitespace() {
b += 1;
}
while b < e && s[e - 1].is_whitespace() {
while beg < e && s[e - 1].is_whitespace() {
e -= 1;
}
(b, e)
Expand Down
11 changes: 10 additions & 1 deletion tests/by-util/test_ptx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore roff

// spell-checker:ignore funnnnnnnnnnnnnnnnn
use uutests::new_ucmd;

#[test]
fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails_with_code(1);
}

#[test]
fn test_truncation_no_extra_space_in_after() {
new_ucmd!()
.args(&["-G", "-w", "30"])
.pipe_in("Rust is funnnnnnnnnnnnnnnnn")
.succeeds()
.stdout_contains(".xx \"\" \"Rust\" \"is/\" \"\"");
}

#[test]
fn gnu_ext_disabled_rightward_no_ref() {
new_ucmd!()
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载