From f911c66312a6e9c4e6daf8ee9c5f1f810c3779c1 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Sun, 5 May 2024 13:55:00 +0200 Subject: [PATCH] runner: make `generate()` public --- CHANGELOG.md | 1 + src/lib.rs | 2 +- src/runner.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f20f1b1..de10826 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Backwards-incompatible changes: Improvements: +* Add `generate()` to generate output for a goldenscript input. * Add `Argument.parse()` to parse values into e.g. integers or booleans. * Add `Command.line_number` with the command's position in the script. * Add `Runner` error context such as the command or hook name and line number. diff --git a/src/lib.rs b/src/lib.rs index 73c968c..76457d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -332,4 +332,4 @@ mod parser; mod runner; pub use command::{Argument, Command}; -pub use runner::{run, Runner}; +pub use runner::{generate, run, Runner}; diff --git a/src/runner.rs b/src/runner.rs index 764bdd1..42caefa 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -57,7 +57,7 @@ pub fn run>(runner: &mut R, path: P) -> std } /// Generates output for a goldenscript input, without comparing them. -pub(crate) fn generate(runner: &mut R, input: &str) -> std::io::Result { +pub fn generate(runner: &mut R, input: &str) -> std::io::Result { let mut output = String::with_capacity(input.len()); // common case: output == input // Detect end-of-line format.