Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jun 5, 2021
1 parent 06377e5 commit 115db26
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repository = "https://github.com/Byron/dua-cli"
readme = "README.md"
description = "A tool to conveniently learn about the disk usage of directories, fast!"
license = "MIT"
include = ["src/**/*", "Cargo.*", "LICENSE", "README.md", "CHANGELOG.md", "!**/*_test/*"]
include = ["src/**/*", "Cargo.*", "LICENSE", "README.md", "CHANGELOG.md", "!**/tests/*"]

[features]
default = ["tui-crossplatform"]
Expand Down
3 changes: 3 additions & 0 deletions src/interactive/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ pub use bytevis::*;
pub use common::*;
pub use eventloop::*;
pub use handlers::*;

#[cfg(test)]
mod tests;
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use crate::interactive::{
app_test::utils::{
fixture_str, index_by_name, initialized_app_and_terminal_from_fixture, into_keys,
node_by_index, node_by_name,
},
app_test::FIXTURE_PATH,
SortMode,
};
use anyhow::Result;
use pretty_assertions::assert_eq;
use std::ffi::OsString;

use crate::interactive::app::tests::utils::{
fixture_str, index_by_name, initialized_app_and_terminal_from_fixture, into_keys,
node_by_index, node_by_name,
};
use crate::interactive::app::tests::FIXTURE_PATH;
use crate::interactive::SortMode;

#[test]
fn simple_user_journey_read_only() -> Result<()> {
let long_root = "sample-02/dir";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::interactive::app_test::utils::{
use crate::interactive::app::tests::utils::{
initialized_app_and_terminal_from_paths, into_keys, WritableFixture,
};
use anyhow::Result;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::interactive::app_test::utils::{
use crate::interactive::app::tests::utils::{
debug, initialized_app_and_terminal_from_fixture, sample_01_tree, sample_02_tree,
};
use anyhow::Result;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::interactive::{app_test::FIXTURE_PATH, Interaction, TerminalApp};
use anyhow::{Context, Error, Result};
use dua::{
traverse::{EntryData, Tree, TreeIndex},
Expand All @@ -18,6 +17,8 @@ use std::{
use tui::backend::TestBackend;
use tui_react::Terminal;

use crate::interactive::{app::tests::FIXTURE_PATH, Interaction, TerminalApp};

pub fn into_keys<'a>(
bytes: impl Iterator<Item = &'a u8> + 'a,
) -> impl Iterator<Item = crosstermion::input::Key> + 'a {
Expand Down Expand Up @@ -160,8 +161,8 @@ pub fn fixture_str(p: impl AsRef<Path>) -> String {
fixture(p).to_str().unwrap().to_owned()
}

pub fn initialized_app_and_terminal_with_closure<P: AsRef<Path>>(
fixture_paths: &[P],
pub fn initialized_app_and_terminal_with_closure(
fixture_paths: &[impl AsRef<Path>],
mut convert: impl FnMut(&Path) -> PathBuf,
) -> Result<(Terminal<TestBackend>, TerminalApp), Error> {
let mut terminal = new_test_terminal()?;
Expand Down
9 changes: 3 additions & 6 deletions src/interactive/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod app;
pub mod widgets;
pub use app::*;

pub use self::app::*;
pub mod widgets;

mod utils {
use dua::{
Expand Down Expand Up @@ -29,7 +29,4 @@ mod utils {
})
}
}
pub use utils::*;

#[cfg(test)]
mod app_test;
pub use utils::path_of;

0 comments on commit 115db26

Please sign in to comment.