diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-12-10 09:05:11 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-12-10 09:07:10 +0200 |
commit | 07fb523edb88ed258243869ab474ee7a24e1e4de (patch) | |
tree | 0cac21072c9c7ab6096000f5d85db1455caa26ae /subplot | |
parent | d7ede939445fc73b782424c9e73fdadfcf4d4360 (diff) | |
download | pandoc-filter-diagram-07fb523edb88ed258243869ab474ee7a24e1e4de.tar.gz |
test: add implementation, running of Subplot scenarios
Sponsored-by: author
Diffstat (limited to 'subplot')
-rw-r--r-- | subplot/subplot.rs | 30 | ||||
-rw-r--r-- | subplot/subplot.yaml | 4 |
2 files changed, 34 insertions, 0 deletions
diff --git a/subplot/subplot.rs b/subplot/subplot.rs new file mode 100644 index 0000000..1496154 --- /dev/null +++ b/subplot/subplot.rs @@ -0,0 +1,30 @@ +// Rust support for running Subplot scenarios for +// pandoc-filter-diagram. + +use subplotlib::steplibrary::runcmd::Runcmd; + +use std::env; +use std::path::Path; + +#[step] +#[context(Runcmd)] +fn install_rust_program(context: &ScenarioContext, name: &str) { + println!("install_rust_program 1"); + println!("install_rust_program: name={:?}", name); + let target_dir = Path::new(env!("CARGO_TARGET_DIR")); + let exe = target_dir.join("debug").join(name); + println!("install_rust_program: exe={:?} {}", exe, exe.exists()); + assert!(exe.exists()); + println!("install_rust_program 2"); + let path = Path::new(&exe).parent().ok_or("No parent?")?; + println!("install_rust_program 3"); + + context.with_mut( + |context: &mut Runcmd| { + context.prepend_to_path(path); + Ok(()) + }, + false, + )?; + println!("install_rust_program 999"); +} diff --git a/subplot/subplot.yaml b/subplot/subplot.yaml new file mode 100644 index 0000000..14f5856 --- /dev/null +++ b/subplot/subplot.yaml @@ -0,0 +1,4 @@ +- given: an installed Rust program {name} + impl: + rust: + function: install_rust_program |