From acfaf757eccfd807fa3408e1a7a475b9f50f9c9d Mon Sep 17 00:00:00 2001 From: unspeaker Date: Tue, 14 Jan 2025 16:59:45 +0100 Subject: [PATCH] fix test suite --- .forgejo/workflows/build.yaml | 4 ++-- Justfile | 2 +- midi/examples/midi-import.rs | 6 ++--- output/examples/edn-view.rs | 41 ++++++++++++++++------------------- 4 files changed, 24 insertions(+), 29 deletions(-) diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index ac4cd93b..bc4f2fe6 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -7,5 +7,5 @@ jobs: - run: nix-channel --list && nix-channel --update - run: nix-shell -p git --command 'git clone --recursive $GITHUB_SERVER_URL/$GITHUB_REPOSITORY .' - run: whoami && pwd && ls -al - - run: nix-shell --command 'cloc src/ && cloc . && rustup install nightly && cargo version -vv && cargo test && cargo doc && cargo build --release' .forgejo/workflows/build.nix - - run: nix-shell -p docker --command "docker run --security-opt seccomp=unconfined -v $PWD:/volume xd009642/tarpaulin cargo tarpaulin --out Html --all-features" + - run: nix-shell --command 'cloc src/ && cloc . && rustup install nightly && cargo version -vv && just test && cargo doc && cargo build --release' .forgejo/workflows/build.nix + #- run: nix-shell -p docker --command "docker run --security-opt seccomp=unconfined -v $PWD:/volume xd009642/tarpaulin cargo tarpaulin --out Html --all-features" diff --git a/Justfile b/Justfile index 70dd3e79..79e425d1 100644 --- a/Justfile +++ b/Justfile @@ -9,7 +9,7 @@ edn-keys: cargo run --example edn-keys test: - cargo test --workspace + cargo test --workspace --exclude jack cloc: for src in {cli,edn/src,input/src,jack/src,midi/src,output/src,plugin/src,sampler/src,tek/src,time/src,tui/src}; do echo; echo $src; cloc --quiet $src; done diff --git a/midi/examples/midi-import.rs b/midi/examples/midi-import.rs index 802bf5b4..72cea99f 100644 --- a/midi/examples/midi-import.rs +++ b/midi/examples/midi-import.rs @@ -1,8 +1,7 @@ use tek_midi::*; +use tek_tui::tek_input::*; use std::sync::*; - struct ExampleClips(Arc>>>>); - impl HasClips for ExampleClips { fn clips (&self) -> RwLockReadGuard<'_, Vec>>> { self.0.read().unwrap() @@ -11,9 +10,8 @@ impl HasClips for ExampleClips { self.0.write().unwrap() } } - fn main () -> Result<(), Box> { let mut clips = ExampleClips(Arc::new(vec![].into())); - PoolClipCommand::Import(0, String::from("./example.mid")).execute(&mut clips)?; + PoolClipCommand::Import(0, std::path::PathBuf::from("./example.mid")).execute(&mut clips)?; Ok(()) } diff --git a/output/examples/edn-view.rs b/output/examples/edn-view.rs index c38c4966..ac35f494 100644 --- a/output/examples/edn-view.rs +++ b/output/examples/edn-view.rs @@ -19,35 +19,32 @@ const EDN: &'static [&'static str] = &[ include_str!("edn12.edn"), include_str!("edn13.edn"), ]; - fn main () -> Usually<()> { let state = Arc::new(RwLock::new(Example(10, Measure::new()))); Tui::new().unwrap().run(&state)?; Ok(()) } - #[derive(Debug)] pub struct Example(usize, Measure); - -edn_provide_content!(|self: Example|{ - ":title" => Tui::bg(Color::Rgb(60,10,10), Push::y(1, Align::n(format!("Example {}/{}:", self.0 + 1, EDN.len())))).boxed(), - ":code" => Tui::bg(Color::Rgb(10,60,10), Push::y(2, Align::n(format!("{}", EDN[self.0])))).boxed(), - ":hello-world" => "Hello world!".boxed(), - ":hello" => Tui::bg(Color::Rgb(10, 100, 10), "Hello").boxed(), - ":world" => Tui::bg(Color::Rgb(100, 10, 10), "world").boxed(), -}); - -impl Content for Example { - fn content (&self) -> impl Render { - let title = Tui::bg(Color::Rgb(60,10,10), - Push::y(1, Align::n(format!("Example {}/{} in {:?}", self.0 + 1, EDN.len(), &self.1.wh())))); - let code = Tui::bg(Color::Rgb(10,60,10), - Push::y(2, Align::n(format!("{}", EDN[self.0])))); - let content = Tui::bg(Color::Rgb(10,10,60), - EdnView::from_source(self, EDN[self.0])); - self.1.of(Bsp::s(title, Bsp::n(""/*code*/, content))) +edn_view!(TuiOut: |self: Example|{ + let title = Tui::bg(Color::Rgb(60,10,10), + Push::y(1, Align::n(format!("Example {}/{} in {:?}", self.0 + 1, EDN.len(), &self.1.wh())))); + let code = Tui::bg(Color::Rgb(10,60,10), + Push::y(2, Align::n(format!("{}", EDN[self.0])))); + let content = Tui::bg(Color::Rgb(10,10,60), + EdnView::from_source(self, EDN[self.0])); + self.1.of(Bsp::s(title, Bsp::n(""/*code*/, content))) +};{ + bool {}; + u16 {}; + usize {}; + Box + 'a> { + ":title" => Tui::bg(Color::Rgb(60,10,10), Push::y(1, Align::n(format!("Example {}/{}:", self.0 + 1, EDN.len())))).boxed(), + ":code" => Tui::bg(Color::Rgb(10,60,10), Push::y(2, Align::n(format!("{}", EDN[self.0])))).boxed(), + ":hello-world" => "Hello world!".boxed(), + ":hello" => Tui::bg(Color::Rgb(10, 100, 10), "Hello").boxed(), + ":world" => Tui::bg(Color::Rgb(100, 10, 10), "world").boxed() } -} - +}); impl Handle for Example { fn handle (&mut self, input: &TuiIn) -> Perhaps { match input.event() {