updates and fixes

This commit is contained in:
dependabot[bot] 2023-10-25 02:32:20 +00:00 committed by extrawurst
parent 0383f9517b
commit 61ee3fd695
6 changed files with 17 additions and 18 deletions

View File

@ -125,15 +125,15 @@ pub struct Environment {
/// The need to construct a "whatever" environment only arises in testing right now
#[cfg(test)]
impl Default for Environment {
fn default() -> Self {
impl Environment {
pub fn test_env() -> Self {
use crossbeam_channel::unbounded;
Self {
queue: Queue::new(),
theme: Default::default(),
key_config: Default::default(),
repo: RefCell::new(RepoPath::Path(Default::default())),
options: Default::default(),
options: Rc::new(RefCell::new(Options::test_env())),
sender_git: unbounded().0,
sender_app: unbounded().0,
}

View File

@ -32,8 +32,6 @@ pub struct ChangesComponent {
impl ChangesComponent {
///
//TODO: fix
#[allow(clippy::too_many_arguments)]
pub fn new(
env: &Environment,
title: &str,

View File

@ -4,6 +4,7 @@ use super::{
EventState, ExternalEditorComponent,
};
use crate::{
app::Environment,
keys::{key_match, SharedKeyConfig},
options::SharedOptions,
queue::{InternalEvent, NeedsUpdate, Queue},
@ -65,7 +66,7 @@ const FIRST_LINE_LIMIT: usize = 50;
impl CommitComponent {
///
pub fn new(env: &crate::app::Environment) -> Self {
pub fn new(env: &Environment) -> Self {
Self {
queue: env.queue.clone(),
mode: Mode::Normal,

View File

@ -590,7 +590,7 @@ mod tests {
// set up file tree
let mut ftc = StatusTreeComponent::new(
&Default::default(),
&Environment::test_env(),
"title",
true,
);
@ -630,7 +630,7 @@ mod tests {
// set up file tree
let mut ftc = StatusTreeComponent::new(
&Default::default(),
&Environment::test_env(),
"title",
true,
);

View File

@ -555,7 +555,7 @@ mod tests {
#[test]
fn test_smoke() {
let mut comp = TextInputComponent::new(
&Environment::default(),
&Environment::test_env(),
"",
"",
false,
@ -575,7 +575,7 @@ mod tests {
#[test]
fn text_cursor_initial_position() {
let mut comp = TextInputComponent::new(
&Environment::default(),
&Environment::test_env(),
"",
"",
false,
@ -600,7 +600,7 @@ mod tests {
#[test]
fn test_cursor_second_position() {
let mut comp = TextInputComponent::new(
&Environment::default(),
&Environment::test_env(),
"",
"",
false,
@ -636,7 +636,7 @@ mod tests {
#[test]
fn test_visualize_newline() {
let mut comp = TextInputComponent::new(
&Environment::default(),
&Environment::test_env(),
"",
"",
false,
@ -671,7 +671,7 @@ mod tests {
#[test]
fn test_invisible_newline() {
let mut comp = TextInputComponent::new(
&Environment::default(),
&Environment::test_env(),
"",
"",
false,
@ -701,7 +701,7 @@ mod tests {
#[test]
fn test_next_word_position() {
let mut comp = TextInputComponent::new(
&Environment::default(),
&Environment::test_env(),
"",
"",
false,
@ -725,7 +725,7 @@ mod tests {
#[test]
fn test_previous_word_position() {
let mut comp = TextInputComponent::new(
&Environment::default(),
&Environment::test_env(),
"",
"",
false,
@ -752,7 +752,7 @@ mod tests {
#[test]
fn test_next_word_multibyte() {
let mut comp = TextInputComponent::new(
&Environment::default(),
&Environment::test_env(),
"",
"",
false,

View File

@ -33,8 +33,8 @@ pub struct Options {
}
#[cfg(test)]
impl Default for Options {
fn default() -> Self {
impl Options {
pub fn test_env() -> Self {
use asyncgit::sync::RepoPath;
Self {
repo: RefCell::new(RepoPath::Path(Default::default())),