aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 8517561..26b0d02 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -27,14 +27,28 @@ fn run_file(path: &Path) -> Result<(), Vec<Error>> {
Ok(block) => vm::run_block(block).or_else(|e| Err(vec![e])),
Err(errors) => Err(errors),
}
-
}
#[cfg(test)]
mod tests {
use super::run_file;
+ use crate::error::{Error, ErrorKind};
use std::path::Path;
+ #[test]
+ fn unreachable_token() {
+ let file = Path::new("tests/unreachable.tdy");
+ assert!(matches!(
+ run_file(&file).unwrap_err().as_slice(),
+ &[Error {
+ kind: ErrorKind::Unreachable,
+ file: _,
+ line: _,
+ message: _,
+ }]
+ ));
+ }
+
macro_rules! test_file {
($fn:ident, $path:literal) => {
#[test]
@@ -44,7 +58,6 @@ mod tests {
}
};
}
-
test_file!(order_of_operations, "tests/order-of-operations.tdy");
test_file!(variables, "tests/variables.tdy");
test_file!(scoping, "tests/scoping.tdy");