File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 $(info lint | run lints with clippy)
77 $(info benchmark | just for fun, really)
88 $(info profile | only on linux - run callgrind and annotate it)
9+ $(info unit-tests | run all unit test)
10+ $(info continuous-unit-tests | run all unit test whenever something changes)
911 $(info journey-tests | run all stateless journey test)
1012 $(info continuous-journey-tests | run all stateless journey test whenever something changes)
1113 $(info -- Use docker for all dependencies - run make interactively from there ----------------)
@@ -33,6 +35,12 @@ profile: target/release/dua
3335benchmark : target/release/dua
3436 hyperfine ' $<'
3537
38+ unit-tests :
39+ cargo test --test interactive
40+
41+ continuous-unit-tests :
42+ watchexec $(MAKE ) unit-tests
43+
3644journey-tests : target/debug/dua
3745 ./tests/stateless-journey.sh $<
3846
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ mod app {
99 pub struct App { }
1010
1111 impl App {
12- pub fn event_loop < B , R > (
12+ pub fn process_events < B , R > (
1313 & mut self ,
1414 terminal : & mut Terminal < B > ,
1515 keys : Keys < R > ,
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ fn run() -> Result<(), Error> {
3939 . with_context ( |_| "Interactive mode requires a connected terminal" ) ?
4040 } ;
4141 let mut app = dua:: interactive:: App :: initialize ( & mut terminal, walk_options, input) ?;
42- app. event_loop ( & mut terminal, io:: stdin ( ) . keys ( ) ) ?
42+ app. process_events ( & mut terminal, io:: stdin ( ) . keys ( ) ) ?
4343 }
4444 Some ( Aggregate {
4545 input,
Original file line number Diff line number Diff line change 1+ mod app {
2+ use dua:: interactive:: App ;
3+ use dua:: { ByteFormat , Color , WalkOptions } ;
4+ use failure:: Error ;
5+ use std:: path:: Path ;
6+ use tui:: backend:: TestBackend ;
7+ use tui:: Terminal ;
8+
9+ #[ test]
10+ fn journey_with_single_path ( ) -> Result < ( ) , Error > {
11+ let mut terminal = Terminal :: new ( TestBackend :: new ( 40 , 20 ) ) ?;
12+ let input = Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "tests/fixtures/sample-01" ) ;
13+
14+ let app = App :: initialize (
15+ & mut terminal,
16+ WalkOptions {
17+ threads : 1 ,
18+ byte_format : ByteFormat :: Metric ,
19+ color : Color :: None ,
20+ } ,
21+ vec ! [ input] ,
22+ ) ?;
23+ Ok ( ( ) )
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments