completely rewrote test suite for top level src files and all builtin files
This commit is contained in:
@@ -23,12 +23,11 @@ pub mod source;
|
||||
pub mod test; // [[ ]] thing
|
||||
pub mod trap;
|
||||
pub mod varcmds;
|
||||
pub mod zoltraak;
|
||||
pub mod resource;
|
||||
|
||||
pub const BUILTINS: [&str; 49] = [
|
||||
"echo", "cd", "read", "export", "local", "pwd", "source", "shift", "jobs", "fg", "bg", "disown",
|
||||
"alias", "unalias", "return", "break", "continue", "exit", "zoltraak", "shopt", "builtin",
|
||||
"echo", "cd", "read", "export", "local", "pwd", "source", ".", "shift", "jobs", "fg", "bg", "disown",
|
||||
"alias", "unalias", "return", "break", "continue", "exit", "shopt", "builtin",
|
||||
"command", "trap", "pushd", "popd", "dirs", "exec", "eval", "true", "false", ":", "readonly",
|
||||
"unset", "complete", "compgen", "map", "pop", "fpop", "push", "fpush", "rotate", "wait", "type",
|
||||
"getopts", "keymap", "read_key", "autocmd", "ulimit", "umask"
|
||||
@@ -48,3 +47,34 @@ pub fn noop_builtin() -> ShResult<()> {
|
||||
state::set_status(0);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use crate::{state, testutil::{TestGuard, test_input}};
|
||||
|
||||
// You can never be too sure!!!!!!
|
||||
|
||||
#[test]
|
||||
fn test_true() {
|
||||
let _g = TestGuard::new();
|
||||
test_input("true").unwrap();
|
||||
|
||||
assert_eq!(state::get_status(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_false() {
|
||||
let _g = TestGuard::new();
|
||||
test_input("false").unwrap();
|
||||
|
||||
assert_eq!(state::get_status(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_noop() {
|
||||
let _g = TestGuard::new();
|
||||
test_input(":").unwrap();
|
||||
|
||||
assert_eq!(state::get_status(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user