elementary shell behavior: can kick off a foreground process and
handle signals
This commit is contained in:
parent
3b1ae0efd5
commit
99cb9e5a2e
17 changed files with 619 additions and 167 deletions
|
|
@ -10,7 +10,7 @@ mod decl_lib_tests {
|
|||
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
|
||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||
let res = *eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||
|
|
@ -25,7 +25,7 @@ mod decl_lib_tests {
|
|||
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
|
||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||
let res = *eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||
|
|
@ -40,7 +40,7 @@ mod decl_lib_tests {
|
|||
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
|
||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||
let res = *eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||
|
|
@ -56,7 +56,7 @@ mod decl_lib_tests {
|
|||
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
|
||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||
eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||
|
|
@ -72,7 +72,7 @@ mod decl_lib_tests {
|
|||
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
|
||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||
eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||
|
|
@ -98,7 +98,7 @@ mod decl_lib_tests {
|
|||
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
|
||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||
eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||
|
|
@ -117,7 +117,7 @@ mod decl_lib_tests {
|
|||
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
|
||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||
eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||
|
|
@ -136,7 +136,7 @@ mod decl_lib_tests {
|
|||
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
|
||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||
let res = *eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||
|
|
@ -150,7 +150,7 @@ mod decl_lib_tests {
|
|||
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
|
||||
let def_tree = lex(&doc1.to_string()).unwrap();
|
||||
let set_tree = lex(&doc2.to_string()).unwrap();
|
||||
|
|
@ -165,7 +165,7 @@ mod decl_lib_tests {
|
|||
let doc = "(set? test)";
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
let set_tree = lex(&doc.to_string()).unwrap();
|
||||
if let Ctr::Bool(b) = *eval(&set_tree, &mut syms).unwrap() {
|
||||
assert!(!b);
|
||||
|
|
@ -179,7 +179,7 @@ mod decl_lib_tests {
|
|||
let doc3 = "t";
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
let set_tree = lex(&doc1.to_string()).unwrap();
|
||||
let env_tree = lex(&doc2.to_string()).unwrap();
|
||||
let tst_tree = lex(&doc3.to_string()).unwrap();
|
||||
|
|
@ -194,7 +194,7 @@ mod decl_lib_tests {
|
|||
let result = "(add 1 2)";
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
assert_eq!(
|
||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||
.unwrap()
|
||||
|
|
@ -211,7 +211,7 @@ mod decl_lib_tests {
|
|||
let result = "3";
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
assert_eq!(
|
||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||
.unwrap()
|
||||
|
|
@ -226,7 +226,7 @@ mod decl_lib_tests {
|
|||
let result = "(1 2 3)";
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
assert_eq!(
|
||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||
.unwrap()
|
||||
|
|
@ -236,7 +236,7 @@ mod decl_lib_tests {
|
|||
}
|
||||
|
||||
/* THIS TEST REMOVED BECAUSE EVAL SHOULDNT ARBITRARILY DO THINGS TWICE
|
||||
* KEPT FOR REFERENCE PURPOSES JUST IN CASE
|
||||
* KEPT FOR REFERENCE PURPOSES JUST IN CASE.
|
||||
#[test]
|
||||
fn test_eval_var_deref() {
|
||||
let def1 = "(def one '' 1)";
|
||||
|
|
@ -261,7 +261,7 @@ mod decl_lib_tests {
|
|||
let document = "(lambda (x y) (add x y))";
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
assert_eq!(
|
||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||
.unwrap()
|
||||
|
|
@ -275,7 +275,7 @@ mod decl_lib_tests {
|
|||
let document = "(lambda () (add 1 2))";
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
assert_eq!(
|
||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||
.unwrap()
|
||||
|
|
@ -289,7 +289,7 @@ mod decl_lib_tests {
|
|||
let document = "((lambda (x y) (add x y)) 1 2)";
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
let it = *eval(
|
||||
&lex(&document.to_string()).unwrap(),
|
||||
&mut syms).unwrap();
|
||||
|
|
@ -306,7 +306,7 @@ mod decl_lib_tests {
|
|||
(adder 1 2))";
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
let it = *eval(
|
||||
&lex(&document.to_string()).unwrap(),
|
||||
&mut syms).unwrap();
|
||||
|
|
@ -324,7 +324,7 @@ mod decl_lib_tests {
|
|||
(adder 1 2))";
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
let it = *eval(
|
||||
&lex(&document.to_string()).unwrap(),
|
||||
&mut syms).unwrap();
|
||||
|
|
@ -343,7 +343,7 @@ mod decl_lib_tests {
|
|||
(appl adder 2))";
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
let it = *eval(
|
||||
&lex(&document.to_string()).unwrap(),
|
||||
&mut syms).unwrap();
|
||||
|
|
@ -361,7 +361,7 @@ mod decl_lib_tests {
|
|||
let document = "(get-doc (q help))";
|
||||
let mut syms = SymTable::new();
|
||||
static_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms).unwrap();
|
||||
dynamic_stdlib(&mut syms, None).unwrap();
|
||||
let _ = *eval(
|
||||
&lex(&highly_inadvisable.to_string()).unwrap(),
|
||||
&mut syms).unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue