tightened up some logic with indenting and joining lines

added more linebuf tests

extracted all verb match arms into private methods on LineBuf
This commit is contained in:
2026-03-13 19:24:30 -04:00
parent 13227943c6
commit 307386ffc6
43 changed files with 3783 additions and 3408 deletions

View File

@@ -17,20 +17,20 @@ pub mod keymap;
pub mod map;
pub mod pwd;
pub mod read;
pub mod resource;
pub mod shift;
pub mod shopt;
pub mod source;
pub mod test; // [[ ]] thing
pub mod trap;
pub mod varcmds;
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", "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"
"getopts", "keymap", "read_key", "autocmd", "ulimit", "umask",
];
pub fn true_builtin() -> ShResult<()> {
@@ -50,31 +50,34 @@ pub fn noop_builtin() -> ShResult<()> {
#[cfg(test)]
pub mod tests {
use crate::{state, testutil::{TestGuard, test_input}};
use crate::{
state,
testutil::{TestGuard, test_input},
};
// You can never be too sure!!!!!!
// You can never be too sure!!!!!!
#[test]
fn test_true() {
let _g = TestGuard::new();
test_input("true").unwrap();
#[test]
fn test_true() {
let _g = TestGuard::new();
test_input("true").unwrap();
assert_eq!(state::get_status(), 0);
}
assert_eq!(state::get_status(), 0);
}
#[test]
fn test_false() {
let _g = TestGuard::new();
test_input("false").unwrap();
#[test]
fn test_false() {
let _g = TestGuard::new();
test_input("false").unwrap();
assert_eq!(state::get_status(), 1);
}
assert_eq!(state::get_status(), 1);
}
#[test]
fn test_noop() {
let _g = TestGuard::new();
test_input(":").unwrap();
#[test]
fn test_noop() {
let _g = TestGuard::new();
test_input(":").unwrap();
assert_eq!(state::get_status(), 0);
}
assert_eq!(state::get_status(), 0);
}
}