mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-14 17:35:03 +01:00
if
This commit is contained in:
parent
88a3a585e7
commit
4e30201be4
11 changed files with 222 additions and 20 deletions
24
tests/common.rs
Normal file
24
tests/common.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#[macro_export]
|
||||
macro_rules! run_test {
|
||||
($name:ident, $code:expr) => {
|
||||
#[test]
|
||||
fn $name() {
|
||||
let code = $code;
|
||||
let output = _run_test(code);
|
||||
insta::assert_debug_snapshot!(output);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub fn _run_test(code: &str) -> String {
|
||||
let mut stdout = Vec::<u8>::new();
|
||||
let mut cfg = dilaria::Config {
|
||||
debug: false,
|
||||
stdout: &mut stdout,
|
||||
};
|
||||
|
||||
dilaria::run_program(code, &mut cfg);
|
||||
|
||||
String::from_utf8(stdout).unwrap()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue