rustfmt previous commit

This commit is contained in:
Ava Hahn 2023-03-05 22:21:18 -08:00
parent dc6342bc74
commit ca9f755d50
Signed by untrusted user who does not match committer: affine
GPG key ID: 3A4645B8CF806069
10 changed files with 144 additions and 123 deletions

View file

@ -36,9 +36,9 @@ pub fn configure(filename: String, syms: &mut SymTable) -> Result<(), String> {
args: Args::None, args: Args::None,
conditional_branches: false, conditional_branches: false,
docs: "variable holding whether or not POSIX job control functions are to be loaded. docs: "variable holding whether or not POSIX job control functions are to be loaded.
checked at shell startup by configuration daemon. not used afterwards. checked at shell startup by configuration daemon. not used afterwards.
default value: not set".to_string(), default value: not set".to_string(),
value: ValueType::VarForm(Box::new(Ctr::String("0".to_string()))), value: ValueType::VarForm(Box::new(Ctr::String("0".to_string()))),
}, },
);*/ );*/
@ -66,7 +66,8 @@ default value: 1 (set)
args: Args::None, args: Args::None,
conditional_branches: false, conditional_branches: false,
docs: "function called to output prompt. this function is called with no arguments. docs: "function called to output prompt. this function is called with no arguments.
default value (<lambda>)".to_string(), default value (<lambda>)"
.to_string(),
value: ValueType::Internal(Rc::new(prompt_default_callback)), value: ValueType::Internal(Rc::new(prompt_default_callback)),
}, },
); );

View file

@ -89,7 +89,8 @@ example: (let ((step1 'hello')
In this example step1, step2, and step3 are created sequentially. In this example step1, step2, and step3 are created sequentially.
Then, the echo form is evaluated, printing 'hello-world'. Then, the echo form is evaluated, printing 'hello-world'.
Finally, the some-func form is evaluated. Finally, the some-func form is evaluated.
Since the call to some-func is the final form, its value is returned.".to_string(), Since the call to some-func is the final form, its value is returned."
.to_string(),
value: ValueType::Internal(Rc::new(control::let_callback)), value: ValueType::Internal(Rc::new(control::let_callback)),
}, },
); );
@ -126,7 +127,8 @@ example: (circuit (eq? (do-operation) myresult)
false false
(do-another-operation)) (do-another-operation))
in this example, do-another-operation will not be called".to_string(), in this example, do-another-operation will not be called"
.to_string(),
value: ValueType::Internal(Rc::new(control::circuit_callback)), value: ValueType::Internal(Rc::new(control::circuit_callback)),
}, },
); );
@ -139,7 +141,8 @@ in this example, do-another-operation will not be called".to_string(),
conditional_branches: false, conditional_branches: false,
docs: "traverses a list of N arguments, all of which are expected to be boolean. docs: "traverses a list of N arguments, all of which are expected to be boolean.
starts with arg1 AND arg2, and then calculates prev_result AND next_arg. starts with arg1 AND arg2, and then calculates prev_result AND next_arg.
returns final result.".to_string(), returns final result."
.to_string(),
value: ValueType::Internal(Rc::new(boolean::bool_and_callback)), value: ValueType::Internal(Rc::new(boolean::bool_and_callback)),
}, },
); );
@ -152,7 +155,8 @@ returns final result.".to_string(),
conditional_branches: false, conditional_branches: false,
docs: "traverses a list of N arguments, all of which are expected to be boolean. docs: "traverses a list of N arguments, all of which are expected to be boolean.
starts with arg1 OR arg2, and then calculates prev_result OR next_arg. starts with arg1 OR arg2, and then calculates prev_result OR next_arg.
returns final result.".to_string(), returns final result."
.to_string(),
value: ValueType::Internal(Rc::new(boolean::bool_or_callback)), value: ValueType::Internal(Rc::new(boolean::bool_or_callback)),
}, },
); );
@ -164,7 +168,8 @@ returns final result.".to_string(),
args: Args::Strict(vec![Type::Bool]), args: Args::Strict(vec![Type::Bool]),
conditional_branches: false, conditional_branches: false,
docs: "takes a single argument (expects a boolean). docs: "takes a single argument (expects a boolean).
returns false if arg is true or true if arg is false.".to_string(), returns false if arg is true or true if arg is false."
.to_string(),
value: ValueType::Internal(Rc::new(boolean::bool_not_callback)), value: ValueType::Internal(Rc::new(boolean::bool_not_callback)),
}, },
); );
@ -177,7 +182,8 @@ returns false if arg is true or true if arg is false.".to_string(),
conditional_branches: false, conditional_branches: false,
docs: "traverses a list of N arguments. docs: "traverses a list of N arguments.
returns true if all arguments hold the same value. returns true if all arguments hold the same value.
NOTE: 1 and 1.0 are the same, but '1' 'one' or one (symbol) aren't".to_string(), NOTE: 1 and 1.0 are the same, but '1' 'one' or one (symbol) aren't"
.to_string(),
value: ValueType::Internal(Rc::new(boolean::bool_iseq_callback)), value: ValueType::Internal(Rc::new(boolean::bool_iseq_callback)),
}, },
); );
@ -190,7 +196,8 @@ NOTE: 1 and 1.0 are the same, but '1' 'one' or one (symbol) aren't".to_string(),
conditional_branches: true, conditional_branches: true,
docs: "switches a boolean symbol between true or false. docs: "switches a boolean symbol between true or false.
Takes a single argument (a symbol). Looks it up in the variable table. Takes a single argument (a symbol). Looks it up in the variable table.
Either sets the symbol to true if it is currently false, or vice versa.".to_string(), Either sets the symbol to true if it is currently false, or vice versa."
.to_string(),
value: ValueType::Internal(Rc::new(boolean::bool_toggle_callback)), value: ValueType::Internal(Rc::new(boolean::bool_toggle_callback)),
}, },
); );
@ -237,7 +244,8 @@ pub fn dynamic_stdlib(syms: &mut SymTable) -> Result<(), String> {
(def myfunc 'does a thing' (myarg1 myarg2) (dothing myarg1 myarg2) (add myarg1 myarg2)) (def myfunc 'does a thing' (myarg1 myarg2) (dothing myarg1 myarg2) (add myarg1 myarg2))
3. symbol un-definition: 3. symbol un-definition:
Takes just a name. Removes variable from table. Takes just a name. Removes variable from table.
(def useless-var)".to_string(), (def useless-var)"
.to_string(),
value: ValueType::Internal(Rc::new( value: ValueType::Internal(Rc::new(
move |ast: &Seg, syms: &mut SymTable| -> Result<Ctr, String> { move |ast: &Seg, syms: &mut SymTable| -> Result<Ctr, String> {
_store_callback(ast, syms, env_cfg_user_form) _store_callback(ast, syms, env_cfg_user_form)
@ -261,7 +269,7 @@ fn _echo_callback(ast: &Seg, _syms: &mut SymTable) -> Result<Ctr, String> {
fn _help_callback(ast: &Seg, syms: &mut SymTable) -> Result<Ctr, String> { fn _help_callback(ast: &Seg, syms: &mut SymTable) -> Result<Ctr, String> {
if ast.len() != 1 { if ast.len() != 1 {
return Err("help only takes a single argument".to_string()) return Err("help only takes a single argument".to_string());
} }
if let Ctr::Symbol(ref symbol) = *ast.car { if let Ctr::Symbol(ref symbol) = *ast.car {
if let Some(ref sym) = syms.get(symbol) { if let Some(ref sym) = syms.get(symbol) {
@ -271,17 +279,20 @@ fn _help_callback(ast: &Seg, syms: &mut SymTable) -> Result<Ctr, String> {
} else { } else {
args_str = sym.args.to_string(); args_str = sym.args.to_string();
} }
println!("NAME: {0}\n println!(
"NAME: {0}\n
ARGS: {1}\n ARGS: {1}\n
DOCUMENTATION:\n DOCUMENTATION:\n
{2}\n {2}\n
CURRENT VALUE AND/OR BODY: CURRENT VALUE AND/OR BODY:
(TODO)", sym.name, args_str, sym.docs); (TODO)",
sym.name, args_str, sym.docs
);
} else { } else {
return Err("undefined symbol".to_string()) return Err("undefined symbol".to_string());
} }
} else { } else {
return Err("help should only be called on a symbol".to_string()) return Err("help should only be called on a symbol".to_string());
} }
Ok(Ctr::None) Ok(Ctr::None)
@ -336,7 +347,8 @@ fn _store_callback(ast: &Seg, syms: &mut SymTable, env_cfg: bool) -> Result<Ctr,
} }
}) { }) {
return Err( return Err(
"all arguments defined for function must be of type symbol".to_string() "all arguments defined for function must be of type symbol"
.to_string(),
); );
}; };
@ -361,17 +373,19 @@ fn _store_callback(ast: &Seg, syms: &mut SymTable, env_cfg: bool) -> Result<Ctr,
); );
} }
} else { } else {
return Err("expected list of arguments in function definition".to_string()); return Err(
"expected list of arguments in function definition".to_string()
);
}
} }
},
// theres a name and a doc string but nothing else // theres a name and a doc string but nothing else
_ => return Err("have name and doc string, but no body.".to_string()) _ => return Err("have name and doc string, but no body.".to_string()),
} }
} else { } else {
return Err("doc string is a required argument".to_string()) return Err("doc string is a required argument".to_string());
}
} }
},
// undefine a symbol // undefine a symbol
Ctr::None => { Ctr::None => {
@ -379,12 +393,12 @@ fn _store_callback(ast: &Seg, syms: &mut SymTable, env_cfg: bool) -> Result<Ctr,
if env_cfg { if env_cfg {
env::remove_var(identifier); env::remove_var(identifier);
} }
}, }
_ => return Err("arguments not in standard form".to_string()), _ => return Err("arguments not in standard form".to_string()),
} }
} else { } else {
return Err("first argument to export must be a symbol".to_string()) return Err("first argument to export must be a symbol".to_string());
} }
Ok(Ctr::None) Ok(Ctr::None)
} }

View file

@ -18,8 +18,8 @@
use crate::eval::eval; use crate::eval::eval;
use crate::segment::{Ctr, Seg, Type}; use crate::segment::{Ctr, Seg, Type};
use std::collections::HashMap; use std::collections::HashMap;
use std::rc::Rc;
use std::fmt; use std::fmt;
use std::rc::Rc;
#[derive(Clone)] #[derive(Clone)]
pub struct SymTable(HashMap<String, Symbol>); pub struct SymTable(HashMap<String, Symbol>);

View file

@ -18,7 +18,6 @@ mod eval_tests {
let doc_tree = lex(&test_doc).unwrap(); let doc_tree = lex(&test_doc).unwrap();
let reduced = *eval(&doc_tree, &mut syms).unwrap(); let reduced = *eval(&doc_tree, &mut syms).unwrap();
assert_eq!(reduced.to_string(), test_doc); assert_eq!(reduced.to_string(), test_doc);
} }
#[test] #[test]

View file

@ -25,7 +25,10 @@ mod func_tests {
}; };
let args = Seg::from(Box::new(Ctr::Bool(true)), Box::new(Ctr::None)); let args = Seg::from(Box::new(Ctr::Bool(true)), Box::new(Ctr::None));
syms.insert(String::from("test_func_in"), test_internal_func); syms.insert(String::from("test_func_in"), test_internal_func);
if let Ctr::Bool(b) = *syms.call_symbol(&"test_func_in".to_string(), &args, true).unwrap() { if let Ctr::Bool(b) = *syms
.call_symbol(&"test_func_in".to_string(), &args, true)
.unwrap()
{
assert!(b) assert!(b)
} }
} }
@ -51,7 +54,10 @@ mod func_tests {
); );
syms.insert(String::from("test_func_in"), test_external_func); syms.insert(String::from("test_func_in"), test_external_func);
if let Ctr::Bool(b) = *syms.call_symbol(&"test_func_in".to_string(), &args, true).unwrap() { if let Ctr::Bool(b) = *syms
.call_symbol(&"test_func_in".to_string(), &args, true)
.unwrap()
{
assert!(b) assert!(b)
} }
} }
@ -77,10 +83,13 @@ mod func_tests {
); );
syms.insert(String::from("echo_2"), test_external_func); syms.insert(String::from("echo_2"), test_external_func);
assert_eq!(*syms.call_symbol(&"echo_2".to_string(), &args, true) assert_eq!(
*syms
.call_symbol(&"echo_2".to_string(), &args, true)
.unwrap() .unwrap()
.to_string(), .to_string(),
"'test'".to_string()); "'test'".to_string()
);
} }
#[test] #[test]
@ -122,10 +131,12 @@ mod func_tests {
let args = Seg::from(Box::new(Ctr::Bool(true)), Box::new(Ctr::None)); let args = Seg::from(Box::new(Ctr::Bool(true)), Box::new(Ctr::None));
syms.insert(String::from("test_inner"), inner_func); syms.insert(String::from("test_inner"), inner_func);
syms.insert(String::from("test_outer"), outer_func); syms.insert(String::from("test_outer"), outer_func);
assert_eq!(syms.call_symbol(&"test_outer".to_string(), &args, true) assert_eq!(
syms.call_symbol(&"test_outer".to_string(), &args, true)
.unwrap() .unwrap()
.to_string(), .to_string(),
"'test'".to_string()); "'test'".to_string()
);
} }
#[test] #[test]
@ -241,8 +252,7 @@ mod func_tests {
syms.call_symbol(&"test_func_in".to_string(), &args, true) syms.call_symbol(&"test_func_in".to_string(), &args, true)
.err() .err()
.unwrap(), .unwrap(),
"error in call to undefined-symbol: undefined symbol: undefined-symbol" "error in call to undefined-symbol: undefined symbol: undefined-symbol".to_string(),
.to_string(),
); );
} }
} }

View file

@ -4,86 +4,59 @@ mod lex_tests {
#[test] #[test]
fn test_lex_basic_pair() { fn test_lex_basic_pair() {
let document = String::from("(hello 'world')"); let document = String::from("(hello 'world')");
assert_eq!( assert_eq!(lex(&document).unwrap().to_string(), document);
lex(&document).unwrap().to_string(),
document
);
} }
#[test] #[test]
fn test_lex_basic_list() { fn test_lex_basic_list() {
let document = String::from("(hello 'world' 1 2 3)"); let document = String::from("(hello 'world' 1 2 3)");
assert_eq!( assert_eq!(lex(&document).unwrap().to_string(), document);
lex(&document).unwrap().to_string(),
document
);
} }
#[test] #[test]
fn test_lex_complex_list() { fn test_lex_complex_list() {
let document = String::from("(hello 'world' (1 2 (1 2 3)) 1 2 3)"); let document = String::from("(hello 'world' (1 2 (1 2 3)) 1 2 3)");
assert_eq!( assert_eq!(lex(&document).unwrap().to_string(), document);
lex(&document).unwrap().to_string(),
document
);
} }
#[test] #[test]
fn test_bad_symbol() { fn test_bad_symbol() {
let document = String::from("(as;dd)"); let document = String::from("(as;dd)");
let output: &str = "Problem lexing document: \"Unparsable token: as;dd\""; let output: &str = "Problem lexing document: \"Unparsable token: as;dd\"";
assert_eq!( assert_eq!(lex(&document).err().unwrap(), output.to_string(),);
lex(&document).err().unwrap(),
output.to_string(),
);
} }
#[test] #[test]
fn test_list_delim_in_str() { fn test_list_delim_in_str() {
let document = String::from("('(')"); let document = String::from("('(')");
assert_eq!( assert_eq!(lex(&document).unwrap().to_string(), document);
lex(&document).unwrap().to_string(),
document
);
} }
#[test] #[test]
fn test_empty_string() { fn test_empty_string() {
let document = String::from("('')"); let document = String::from("('')");
assert_eq!( assert_eq!(lex(&document).unwrap().to_string(), document);
lex(&document).unwrap().to_string(),
document
);
} }
#[test] #[test]
fn test_unmatched_list_delim_flat() { fn test_unmatched_list_delim_flat() {
let document = String::from("(one two"); let document = String::from("(one two");
let output: &str = "Problem lexing document: \"Unmatched list delimiter in input\""; let output: &str = "Problem lexing document: \"Unmatched list delimiter in input\"";
assert_eq!( assert_eq!(lex(&document).err().unwrap(), output.to_string(),);
lex(&document).err().unwrap(),
output.to_string(),
);
} }
#[test] #[test]
fn test_unmatched_list_delim_complex() { fn test_unmatched_list_delim_complex() {
let document = String::from("(one two (three)"); let document = String::from("(one two (three)");
let output: &str = "Problem lexing document: \"Unmatched list delimiter in input\""; let output: &str = "Problem lexing document: \"Unmatched list delimiter in input\"";
assert_eq!( assert_eq!(lex(&document).err().unwrap(), output.to_string(),);
lex(&document).err().unwrap(),
output.to_string(),
);
} }
#[test] #[test]
fn test_comment() { fn test_comment() {
let document = String::from("#!/bin/relish\n(one two)"); let document = String::from("#!/bin/relish\n(one two)");
let output: &str = "(one two)"; let output: &str = "(one two)";
assert_eq!( assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
lex(&document).unwrap().to_string(),
output.to_string(),
);
} }
#[test] #[test]
@ -91,30 +64,20 @@ mod lex_tests {
let document = let document =
String::from("#!/bin/relish\n((one two)# another doc comment\n(three four))"); String::from("#!/bin/relish\n((one two)# another doc comment\n(three four))");
let output: &str = "((one two) (three four))"; let output: &str = "((one two) (three four))";
assert_eq!( assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
lex(&document).unwrap().to_string(),
output.to_string(),
);
} }
#[test] #[test]
fn test_inline_comment() { fn test_inline_comment() {
let document = String::from("#!/bin/relish\n((one two)\n# another doc comment\nthree)"); let document = String::from("#!/bin/relish\n((one two)\n# another doc comment\nthree)");
let output: &str = "((one two) three)"; let output: &str = "((one two) three)";
assert_eq!( assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
lex(&document).unwrap().to_string(),
output.to_string(),
);
} }
#[test] #[test]
fn test_bad_token_list() { fn test_bad_token_list() {
let document = String::from("(one t(wo)"); let document = String::from("(one t(wo)");
let output: &str = "Problem lexing document: \"list started in middle of another token\""; let output: &str = "Problem lexing document: \"list started in middle of another token\"";
assert_eq!( assert_eq!(lex(&document).err().unwrap(), output.to_string(),);
lex(&document).err().unwrap(),
output.to_string(),
);
} }
} }

View file

@ -11,7 +11,9 @@ mod append_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
@ -26,7 +28,9 @@ mod append_lib_tests {
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
@ -41,7 +45,9 @@ mod append_lib_tests {
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
@ -56,7 +62,9 @@ mod append_lib_tests {
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
@ -71,7 +79,9 @@ mod append_lib_tests {
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }

View file

@ -10,7 +10,9 @@ mod bool_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
@ -23,7 +25,9 @@ mod bool_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
@ -36,7 +40,9 @@ mod bool_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
@ -49,10 +55,11 @@ mod bool_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
#[test] #[test]
@ -63,10 +70,11 @@ mod bool_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
#[test] #[test]
@ -77,7 +85,9 @@ mod bool_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
@ -90,7 +100,9 @@ mod bool_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }

View file

@ -10,7 +10,9 @@ mod control_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
@ -23,7 +25,9 @@ mod control_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
@ -36,7 +40,9 @@ mod control_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
@ -52,7 +58,9 @@ mod control_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
@ -65,7 +73,9 @@ mod control_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }
@ -83,7 +93,9 @@ mod control_lib_tests {
static_stdlib(&mut syms).unwrap(); static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms).unwrap(); dynamic_stdlib(&mut syms).unwrap();
assert_eq!( assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap().to_string(), *eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
.to_string(),
result.to_string(), result.to_string(),
); );
} }