diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-02-26 17:50:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-26 17:50:58 +0100 |
| commit | 3ede8708a83ce5d9b4abb1ec6257bf54676cd4cb (patch) | |
| tree | 58d3a61762c85e4165af1dbd2dbafa6efdec6e9c /src/lib.rs | |
| parent | cab32da3a8f4b4e25e1d1f287315fe75256ecc89 (diff) | |
| parent | 21b70835bfbc6b8a9c1099bb4a618f1cd457aac0 (diff) | |
| download | sylt-3ede8708a83ce5d9b4abb1ec6257bf54676cd4cb.tar.gz | |
Merge pull request #92 from FredTheDino/breaking-into-sections
Breaking into sections
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -25,7 +25,7 @@ pub fn compile_file(path: &Path, functions: Vec<(String, RustFunction)> ) -> Result<vm::VM, Vec<Error>> { let tokens = tokenizer::file_to_tokens(path); - match compiler::Compiler::new(path, tokens).compile("main", path, &functions) { + match compiler::Compiler::new(path, &tokens).compile("main", path, &functions) { Ok(prog) => { let mut vm = vm::VM::new(); vm.print_blocks = print; @@ -53,7 +53,7 @@ pub fn run_string(s: &str, print: bool, functions: Vec<(String, RustFunction)>) } fn run(tokens: TokenStream, path: &Path, print: bool, functions: Vec<(String, RustFunction)>) -> Result<(), Vec<Error>> { - match compiler::Compiler::new(path, tokens).compile("main", path, &functions) { + match compiler::Compiler::new(path, &tokens).compile("main", path, &functions) { Ok(prog) => { let mut vm = vm::VM::new(); vm.print_blocks = print; @@ -842,7 +842,8 @@ mod tests { #[test] fn $fn() { crate::tests::panic_after(std::time::Duration::from_millis(500), || { - match $crate::run_string($prog, true, Vec::new()) { + let prog = std::concat!("q :: fn {", $prog, "\n{}\n}\nq()"); + match $crate::run_string(&prog, true, Vec::new()) { Ok(()) => {}, Err(errs) => { for e in errs.iter() { @@ -859,7 +860,8 @@ mod tests { #[test] fn $fn() { crate::tests::panic_after(std::time::Duration::from_millis(500), || { - $crate::assert_errs!($crate::run_string($prog, true, Vec::new()), $errs); + let prog = std::concat!("q :: fn {", $prog, "\n{}\n}\nq()"); + $crate::assert_errs!($crate::run_string(&prog, true, Vec::new()), $errs); }) } } |
