Add macro to luaify blocks instead of exprs

This commit is contained in:
2025-06-26 13:57:10 +10:00
parent 2a6015c19a
commit dfd57e0ad0
4 changed files with 43 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
use luaify::luaify;
use luaify::{luaify, luaify_chunk};
use pretty_assertions::assert_eq;
#[test]
@@ -403,3 +403,19 @@ fn length() {
r#"local a,b,c=#a,#b,#c;"#
);
}
#[test]
fn chunk() {
assert_eq!(
luaify_chunk!({
if a == b {
c()
} else if b == c {
a()
} else {
d()
}
}),
"if a==b then c();elseif b==c then a();else d();end;"
);
}