///|
test "readme cli run_cli_bytes" {
let result = @cli.run_cli_bytes(
["-", "--format", "text"],
b"<p>Hello <b>MoonBit</b></p>",
)
debug_inspect(
result,
content=(
#|{
#| exit_code: 0,
#| stdout: "Hello MoonBit\n",
#| stderr: "",
#| file_output_path: None,
#| file_output_content: None,
#|}
),
)
}///|
test "readme cli reader callback" {
let paths : Array[String] = []
let result = @cli.run_cli_with_reader(["page.html", "--format", "markdown"], path => {
paths.push(path)
@utf8.encode("<h1>Title</h1><p>body</p>")
})
// The reader saw the requested path, and stdout has rendered Markdown.
debug_inspect(
(paths, result.stdout),
content=(
#|(["page.html"], "# Title\n\nbody\n")
),
)
}///|
test "readme cli read plan" {
// Stdin: ready to read.
debug_inspect(
@cli.cli_read_plan(["-"]),
content=(
#|CliReadPath("-")
),
)
}#deprecated("implicit derived-impl promotion; call the trait method directly")
fn CliReadPlan::equal(CliReadPlan, CliReadPlan) -> Bool#deprecated("implicit derived-impl promotion; call the trait method directly")
fn CliReadPlan::not_equal(x : CliReadPlan, y : CliReadPlan) -> Bool#deprecated("implicit derived-impl promotion; call the trait method directly")
fn CliReadPlan::to_repr(CliReadPlan) -> ReprInstall
Download zipMoonBit HTML parser and sanitizer ported from JustHTML.
Dependencies