Skip to content

Commit

Permalink
Test completer impls
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenn committed Oct 27, 2024
1 parent bc1667e commit e97e64f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,8 @@ fn find_unclosed_quote(s: &str) -> Option<(usize, Quote)> {

#[cfg(test)]
mod tests {
use super::{Completer, FilenameCompleter};

#[test]
pub fn extract_word() {
let break_chars = super::default_break_chars;
Expand Down Expand Up @@ -604,16 +606,23 @@ mod tests {
#[test]
pub fn candidate_impls() {
struct StrCmp;
impl super::Completer for StrCmp {
impl Completer for StrCmp {
type Candidate = &'static str;
}
struct RcCmp;
impl super::Completer for RcCmp {
impl Completer for RcCmp {
type Candidate = std::rc::Rc<str>;
}
struct ArcCmp;
impl super::Completer for ArcCmp {
impl Completer for ArcCmp {
type Candidate = std::sync::Arc<str>;
}
}

#[test]
pub fn completer_impls() {
struct Wrapper<T: Completer>(T);
let boxed = Box::new(FilenameCompleter::new());
let _ = Wrapper(boxed);
}
}
2 changes: 1 addition & 1 deletion src/tty/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ impl Renderer for PosixRenderer {
}
// position the cursor within the line
if cursor.col > 0 {
write!(self.buffer, "\r\x1b[{}C", cursor.col).unwrap();
write!(self.buffer, "\r\x1b[{}C", cursor.col)?;
} else {
self.buffer.push('\r');
}
Expand Down

0 comments on commit e97e64f

Please sign in to comment.