You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fact that the rustyline::completion::Completer.complete contract takes a rustyline::Context<'_>, which can't be constructed from outside the crate, makes it very difficult to write unit tests for any custom Completer impl that you might have.
I've been trying to update some old code that was using rustyline 1.0, before this parameter was added, and it was very easy. Now it seems like there isn't any option but to delete all my tests?
Example tests (pardon the hacky rust):
#[cfg(test)]
fn verify_completion(input: &str, expected_completion: &str)
{
let completer = MyCustomCompleter::new();
assert_eq!(completer.complete(input, 0).unwrap(), (0, vec![String::from(expected_completion)]));
}
#[test]
fn completion_test_items() {
// Verify that the completion for i completes to items.
verify_completion("i", "items");
verify_completion("ite", "items");
}
Since history/history_index on the Context are private we don't have the option of doing something like:
The fact that the rustyline::completion::Completer.complete contract takes a rustyline::Context<'_>, which can't be constructed from outside the crate, makes it very difficult to write unit tests for any custom Completer impl that you might have.
I've been trying to update some old code that was using rustyline 1.0, before this parameter was added, and it was very easy. Now it seems like there isn't any option but to delete all my tests?
Example tests (pardon the hacky rust):
Since history/history_index on the Context are private we don't have the option of doing something like:
Thanks!
The text was updated successfully, but these errors were encountered: