moar tests
This commit is contained in:
@@ -74,12 +74,17 @@ fn let_var_args() -> anyhow::Result<()> {
|
||||
#[test]
|
||||
fn incorrect_args_count() -> anyhow::Result<()> {
|
||||
let compiled = compile! {
|
||||
debug
|
||||
result
|
||||
"
|
||||
fn doSomething(arg1, arg2){};
|
||||
let i = doSomething();
|
||||
"
|
||||
};
|
||||
|
||||
assert!(matches!(
|
||||
compiled,
|
||||
Err(super::super::Error::AgrumentMismatch(_))
|
||||
));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -17,6 +17,16 @@ macro_rules! compile {
|
||||
output!(writer)
|
||||
}};
|
||||
|
||||
(result $source:expr) => {{
|
||||
let mut writer = std::io::BufWriter::new(Vec::new());
|
||||
let compiler = crate::Compiler::new(
|
||||
parser::Parser::new(tokenizer::Tokenizer::from(String::from($source))),
|
||||
&mut writer,
|
||||
Some(crate::CompilerConfig { debug: true }),
|
||||
);
|
||||
compiler.compile()
|
||||
}};
|
||||
|
||||
(debug $source:expr) => {{
|
||||
let mut writer = std::io::BufWriter::new(Vec::new());
|
||||
let compiler = crate::Compiler::new(
|
||||
|
||||
Reference in New Issue
Block a user