///|
test {
let context = @liquid.LiquidContext::new()
context.set("name", @liquid.string_value("MoonBit"))
let template = @liquid.compile("Hello {{ name | upcase }}!").unwrap()
assert_eq(template.render(context).unwrap(), "Hello MOONBIT!")
}///|
test {
let result = @liquid.apply_filter(
@liquid.array_value([@liquid.number_value(1)]),
"concat",
[@liquid.array_value([@liquid.number_value(2)])],
).unwrap()
assert_eq(result.to_string(), "[1, 2]")
}///|
test {
let context = @liquid.LiquidContext::new()
context.register_template("greeting", "Hello {{ name }}!")
let template = @liquid.compile("{% render 'greeting', name: 'Alice' %}").unwrap()
assert_eq(template.render(context).unwrap(), "Hello Alice!")
}moon run examples/basic --target nativemoon check --target all --deny-warn --warn-list +25+73
moon fmt --check
moon test --target wasm
moon test --target wasm-gc
moon test --target js
moon test --target nativefn apply_filter(value : LiquidValue, name : String, parameters : Array[LiquidValue], options? : Map[String, LiquidValue]) -> Result[LiquidValue, Diagnostic]Install
Download zip