Add macro to luaify blocks instead of exprs
This commit is contained in:
@@ -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;"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user