diff options
author | Matan Kushner <hello@matchai.me> | 2019-04-15 20:54:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-15 20:54:52 -0400 |
commit | 794ae7b2ad3d79009162fa7f2d4fe24997f7c2d1 (patch) | |
tree | 8a60c56f3092c1c21844bd5d842b4b328b67c6ea /src/print.rs | |
parent | ab5490bea691d6c5fbe525a54799c17d4bd76dca (diff) |
Add integration tests (#6)
### Changed
- Added current_dir param to segments to make them more testable
- Moved all existing integration tests to a `tests/` dir
### Added
- A whole bunch of new integration tests
Diffstat (limited to 'src/print.rs')
-rw-r--r-- | src/print.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/print.rs b/src/print.rs index a909e58bc..c86083126 100644 --- a/src/print.rs +++ b/src/print.rs @@ -1,4 +1,5 @@ use clap::ArgMatches; +use std::env; use std::io::{self, Write}; use crate::modules; @@ -6,6 +7,9 @@ use crate::modules; pub fn prompt(args: ArgMatches) { let default_prompt = vec!["directory", "nodejs", "line_break", "character"]; + // TODO: Currently gets the physical directory. Get the logical directory. + let current_path = env::current_dir().expect("Unable to identify current directory."); + // TODO: // - List files in directory // - Index binaries in PATH @@ -18,7 +22,7 @@ pub fn prompt(args: ArgMatches) { default_prompt .iter() - .map(|module| modules::handle(module, &args)) // Compute segments + .map(|module| modules::handle(module, ¤t_path, &args)) // Compute segments .flatten() // Remove segments set to `None` .enumerate() // Turn segment into tuple with index .map(|(index, segment)| segment.output_index(index)) // Generate string outputs |