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