Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Jan 24, 2024
1 parent b14255b commit 021be87
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/completion/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ impl Completer for DefaultCompleter {
/// assert_eq!(
/// completions.complete("bat",3),
/// vec![
/// Suggestion {value: "batcave".into(), description: None, style: None, extra: None, span: Span { start: 0, end: 3 }, append_whitespace: false},
/// Suggestion {value: "batman".into(), description: None, style: None, extra: None, span: Span { start: 0, end: 3 }, append_whitespace: false},
/// Suggestion {value: "batmobile".into(), description: None, style: None, extra: None, span: Span { start: 0, end: 3 }, append_whitespace: false},
/// Suggestion {value: "batcave".into(), display: None, description: None, style: None, extra: None, span: Span { start: 0, end: 3 }, append_whitespace: false},
/// Suggestion {value: "batman".into(), display: None, description: None, style: None, extra: None, span: Span { start: 0, end: 3 }, append_whitespace: false},
/// Suggestion {value: "batmobile".into(), display: None, description: None, style: None, extra: None, span: Span { start: 0, end: 3 }, append_whitespace: false},
/// ]);
///
/// assert_eq!(
/// completions.complete("to the bat",10),
/// vec![
/// Suggestion {value: "batcave".into(), description: None, style: None, extra: None, span: Span { start: 7, end: 10 }, append_whitespace: false},
/// Suggestion {value: "batman".into(), description: None, style: None, extra: None, span: Span { start: 7, end: 10 }, append_whitespace: false},
/// Suggestion {value: "batmobile".into(), description: None, style: None, extra: None, span: Span { start: 7, end: 10 }, append_whitespace: false},
/// Suggestion {value: "batcave".into(), display: None, description: None, style: None, extra: None, span: Span { start: 7, end: 10 }, append_whitespace: false},
/// Suggestion {value: "batman".into(), display: None, description: None, style: None, extra: None, span: Span { start: 7, end: 10 }, append_whitespace: false},
/// Suggestion {value: "batmobile".into(), display: None, description: None, style: None, extra: None, span: Span { start: 7, end: 10 }, append_whitespace: false},
/// ]);
/// ```
fn complete(&mut self, line: &str, pos: usize) -> Vec<Suggestion> {
Expand Down Expand Up @@ -178,15 +178,15 @@ impl DefaultCompleter {
/// completions.insert(vec!["test-hyphen","test_underscore"].iter().map(|s| s.to_string()).collect());
/// assert_eq!(
/// completions.complete("te",2),
/// vec![Suggestion {value: "test".into(), description: None, style: None, extra: None, span: Span { start: 0, end: 2 }, append_whitespace: false}]);
/// vec![Suggestion {value: "test".into(), display: None, description: None, style: None, extra: None, span: Span { start: 0, end: 2 }, append_whitespace: false}]);
///
/// let mut completions = DefaultCompleter::with_inclusions(&['-', '_']);
/// completions.insert(vec!["test-hyphen","test_underscore"].iter().map(|s| s.to_string()).collect());
/// assert_eq!(
/// completions.complete("te",2),
/// vec![
/// Suggestion {value: "test-hyphen".into(), description: None, style: None, extra: None, span: Span { start: 0, end: 2 }, append_whitespace: false},
/// Suggestion {value: "test_underscore".into(), description: None, style: None, extra: None, span: Span { start: 0, end: 2 }, append_whitespace: false},
/// Suggestion {value: "test-hyphen".into(), display: None, description: None, style: None, extra: None, span: Span { start: 0, end: 2 }, append_whitespace: false},
/// Suggestion {value: "test_underscore".into(), display: None, description: None, style: None, extra: None, span: Span { start: 0, end: 2 }, append_whitespace: false},
/// ]);
/// ```
pub fn with_inclusions(incl: &[char]) -> Self {
Expand Down Expand Up @@ -422,6 +422,7 @@ mod tests {
[
Suggestion {
value: "test".into(),
display: None,
description: None,
style: None,
extra: None,
Expand All @@ -430,6 +431,7 @@ mod tests {
},
Suggestion {
value: "this is the reedline crate".into(),
display: None,
description: None,
style: None,
extra: None,
Expand All @@ -438,6 +440,7 @@ mod tests {
},
Suggestion {
value: "this is the reedline crate".into(),
display: None,
description: None,
style: None,
extra: None,
Expand Down
1 change: 1 addition & 0 deletions src/menu/ide_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1472,6 +1472,7 @@ mod tests {
fn fake_suggestion(name: &str, pos: usize) -> Suggestion {
Suggestion {
value: name.to_string(),
display: None,
description: None,
style: None,
extra: None,
Expand Down

0 comments on commit 021be87

Please sign in to comment.