POSIX conditional compilation:
* All features related to POSIX environments (env vars, shell stuff) gated by feature flags * Dependencies optional per feature flags * new CI target for non-POSIX build * new CI target for release binary artifact Signed-off-by: Ava Hahn [ava@sunnypup.io](mailto:ava@sunnypup.io)
This commit is contained in:
parent
5e15109b0c
commit
906cb16355
13 changed files with 330 additions and 319 deletions
|
|
@ -1,11 +1,29 @@
|
||||||
default:
|
default:
|
||||||
image: rust:latest
|
image: rust:latest
|
||||||
|
|
||||||
compile:
|
compile-with-posix-features:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- cargo build
|
- cargo build
|
||||||
|
|
||||||
|
compile-without-posix-features:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- cargo build --no-default-features
|
||||||
|
|
||||||
|
compile-release:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- cargo build --release
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/release/relish
|
||||||
|
only:
|
||||||
|
variables:
|
||||||
|
- $CI_COMMIT_TAG =~ /^v\d+.\d+.\d+-?.*$/
|
||||||
|
except:
|
||||||
|
- branches
|
||||||
|
|
||||||
unit-tests:
|
unit-tests:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
|
|
|
||||||
12
Cargo.toml
12
Cargo.toml
|
|
@ -10,11 +10,15 @@ dirs = "3.0"
|
||||||
# these two are used in src/bin/relish.rs to manage a prompt
|
# these two are used in src/bin/relish.rs to manage a prompt
|
||||||
nu-ansi-term = "0.47.0"
|
nu-ansi-term = "0.47.0"
|
||||||
reedline = "0.17.0"
|
reedline = "0.17.0"
|
||||||
|
# used by main shell to update console dimensions
|
||||||
|
termion = "2.0.1"
|
||||||
# these two used in posix shell layer (src/stl/posix.rs)
|
# these two used in posix shell layer (src/stl/posix.rs)
|
||||||
nix = "0.26.2"
|
nix = { version = "0.26.2", optional = true }
|
||||||
|
libc = { version = "0.2.144", optional = true }
|
||||||
# this one provides a global constant lookup table for simple
|
# this one provides a global constant lookup table for simple
|
||||||
# string escaping in the lexer
|
# string escaping in the lexer
|
||||||
phf = { version = "0.11", default-features = false, features = ["macros"] }
|
phf = { version = "0.11", default-features = false, features = ["macros"] }
|
||||||
libc = "0.2.144"
|
|
||||||
# used by main shell to update consol dimensions
|
[features]
|
||||||
termion = "2.0.1"
|
default = ["posix"]
|
||||||
|
posix = ["dep:nix", "dep:libc"]
|
||||||
|
|
|
||||||
|
|
@ -505,11 +505,6 @@ Note: this section only tracks the state of incomplete TODO items. Having everyt
|
||||||
- (path functions)
|
- (path functions)
|
||||||
- (add this all to the readme)
|
- (add this all to the readme)
|
||||||
- finish basic goals in the [[file:snippets/interactive-devel.rls][interactive development library]]
|
- finish basic goals in the [[file:snippets/interactive-devel.rls][interactive development library]]
|
||||||
- Be able to use features to compile without env or posix stuff
|
|
||||||
- add a new binary target that is a simple posix repl demo
|
|
||||||
- I think you'll need to refactor userlib to hide set behind a conditional
|
|
||||||
based on whether CFG_RELISH_POSIX is set or not
|
|
||||||
- add a compilation task to CI
|
|
||||||
- Release CI
|
- Release CI
|
||||||
- Rename to Flesh
|
- Rename to Flesh
|
||||||
- Make an icon if you feel like it
|
- Make an icon if you feel like it
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ use {
|
||||||
CONSOLE_XDIM_VNAME, CONSOLE_YDIM_VNAME, CFG_FILE_VNAME,
|
CONSOLE_XDIM_VNAME, CONSOLE_YDIM_VNAME, CFG_FILE_VNAME,
|
||||||
L_PROMPT_VNAME, R_PROMPT_VNAME, PROMPT_DELIM_VNAME,
|
L_PROMPT_VNAME, R_PROMPT_VNAME, PROMPT_DELIM_VNAME,
|
||||||
},
|
},
|
||||||
aux::{ShellState, check_jobs},
|
|
||||||
},
|
},
|
||||||
std::{
|
std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
|
|
@ -46,12 +45,17 @@ use {
|
||||||
ColumnarMenu, Emacs, ReedlineMenu,
|
ColumnarMenu, Emacs, ReedlineMenu,
|
||||||
default_emacs_keybindings,
|
default_emacs_keybindings,
|
||||||
},
|
},
|
||||||
nix::unistd,
|
|
||||||
nu_ansi_term::{Color, Style},
|
nu_ansi_term::{Color, Style},
|
||||||
dirs::home_dir,
|
dirs::home_dir,
|
||||||
termion::terminal_size,
|
termion::terminal_size,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature="posix")]
|
||||||
|
use relish::aux::{ShellState, check_jobs};
|
||||||
|
#[cfg(feature="posix")]
|
||||||
|
use nix::unistd;
|
||||||
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct CustomPrompt(String, String, String);
|
pub struct CustomPrompt(String, String, String);
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|
@ -237,24 +241,16 @@ fn main() {
|
||||||
let hist_file_name = home_dir.clone() + HIST_FILE;
|
let hist_file_name = home_dir.clone() + HIST_FILE;
|
||||||
let cfg_file_name = home_dir + CONFIG_FILE_DEFAULT;
|
let cfg_file_name = home_dir + CONFIG_FILE_DEFAULT;
|
||||||
|
|
||||||
// TODO: the next two decls should probably be conditional on CFG_RELISH_POSIX
|
|
||||||
// but in both cases the data must live for the whole program
|
|
||||||
let shell_state_bindings = Rc::new(RefCell::from(ShellState {
|
|
||||||
parent_pid: unistd::Pid::from_raw(0),
|
|
||||||
parent_sid: unistd::Pid::from_raw(0),
|
|
||||||
children: vec![],
|
|
||||||
last_exit_code: 0,
|
|
||||||
attr: None,
|
|
||||||
}));
|
|
||||||
let prompt_ss = shell_state_bindings.clone();
|
|
||||||
|
|
||||||
// setup symtable
|
// setup symtable
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
load_defaults(&mut syms);
|
load_defaults(&mut syms);
|
||||||
load_environment(&mut syms);
|
load_environment(&mut syms);
|
||||||
static_stdlib(&mut syms).unwrap_or_else(|err: String| eprintln!("{}", err));
|
static_stdlib(&mut syms);
|
||||||
// reload this later with the state bindings
|
// reload this later with the state bindings
|
||||||
dynamic_stdlib(&mut syms, None).unwrap_or_else(|err: String| eprintln!("{}", err));
|
#[cfg(feature="posix")]
|
||||||
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
#[cfg(not(feature="posix"))]
|
||||||
|
dynamic_stdlib(&mut syms);
|
||||||
|
|
||||||
// if there are args those are scripts, run them and exit
|
// if there are args those are scripts, run them and exit
|
||||||
if env::args().count() > 1 {
|
if env::args().count() > 1 {
|
||||||
|
|
@ -274,10 +270,23 @@ fn main() {
|
||||||
run(cfg_file.clone(), &mut syms)
|
run(cfg_file.clone(), &mut syms)
|
||||||
.unwrap_or_else(|err: Traceback| eprintln!("failed to load script {}\n{}", cfg_file, err));
|
.unwrap_or_else(|err: Traceback| eprintln!("failed to load script {}\n{}", cfg_file, err));
|
||||||
}
|
}
|
||||||
dynamic_stdlib(&mut syms, Some(shell_state_bindings)).unwrap_or_else(|err: String| eprintln!("{}", err));
|
|
||||||
|
#[cfg(feature="posix")]
|
||||||
|
let prompt_ss: Rc<RefCell<ShellState>>;
|
||||||
|
#[cfg(feature="posix")]
|
||||||
|
{
|
||||||
|
let shell_state_bindings = Rc::new(RefCell::from(ShellState {
|
||||||
|
parent_pid: unistd::Pid::from_raw(0),
|
||||||
|
parent_sid: unistd::Pid::from_raw(0),
|
||||||
|
children: vec![],
|
||||||
|
last_exit_code: 0,
|
||||||
|
attr: None,
|
||||||
|
}));
|
||||||
|
prompt_ss = shell_state_bindings.clone();
|
||||||
|
dynamic_stdlib(&mut syms, Some(shell_state_bindings));
|
||||||
|
}
|
||||||
|
|
||||||
// setup readline
|
// setup readline
|
||||||
|
|
||||||
let completion_menu = Box::new(ColumnarMenu::default().with_name("completion_menu"));
|
let completion_menu = Box::new(ColumnarMenu::default().with_name("completion_menu"));
|
||||||
let mut keybindings = default_emacs_keybindings();
|
let mut keybindings = default_emacs_keybindings();
|
||||||
add_menu_keybindings(&mut keybindings);
|
add_menu_keybindings(&mut keybindings);
|
||||||
|
|
@ -305,8 +314,8 @@ fn main() {
|
||||||
let mut xdimension: u16 = 0;
|
let mut xdimension: u16 = 0;
|
||||||
let mut ydimension: u16 = 0;
|
let mut ydimension: u16 = 0;
|
||||||
loop {
|
loop {
|
||||||
|
#[cfg(feature="posix")]
|
||||||
{
|
{
|
||||||
// update state
|
|
||||||
check_jobs(&mut prompt_ss.borrow_mut());
|
check_jobs(&mut prompt_ss.borrow_mut());
|
||||||
}
|
}
|
||||||
let readline_prompt = make_prompt(&mut syms);
|
let readline_prompt = make_prompt(&mut syms);
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,10 @@ pub mod stdlib {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod aux {
|
pub mod aux {
|
||||||
|
#[cfg(feature="posix")]
|
||||||
pub use crate::stl::posix::args_from_ast;
|
pub use crate::stl::posix::args_from_ast;
|
||||||
|
#[cfg(feature="posix")]
|
||||||
pub use crate::stl::posix::ShellState;
|
pub use crate::stl::posix::ShellState;
|
||||||
|
#[cfg(feature="posix")]
|
||||||
pub use crate::stl::posix::check_jobs;
|
pub use crate::stl::posix::check_jobs;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
src/stl.rs
18
src/stl.rs
|
|
@ -23,7 +23,9 @@ use std::rc::Rc;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::env::vars;
|
use std::env::vars;
|
||||||
|
|
||||||
|
#[cfg(feature = "posix")]
|
||||||
pub mod posix;
|
pub mod posix;
|
||||||
|
|
||||||
pub mod append;
|
pub mod append;
|
||||||
pub mod boolean;
|
pub mod boolean;
|
||||||
pub mod control;
|
pub mod control;
|
||||||
|
|
@ -57,7 +59,7 @@ fn prompt_delimiter_default_callback(_: &Seg, _: &mut SymTable) -> Result<Ctr, T
|
||||||
/// static_stdlib
|
/// static_stdlib
|
||||||
/// inserts all stdlib functions that can be inserted without
|
/// inserts all stdlib functions that can be inserted without
|
||||||
/// any kind of further configuration data into a symtable
|
/// any kind of further configuration data into a symtable
|
||||||
pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
pub fn static_stdlib(syms: &mut SymTable) {
|
||||||
append::add_list_lib(syms);
|
append::add_list_lib(syms);
|
||||||
strings::add_string_lib(syms);
|
strings::add_string_lib(syms);
|
||||||
decl::add_decl_lib_static(syms);
|
decl::add_decl_lib_static(syms);
|
||||||
|
|
@ -76,24 +78,21 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// dynamic_stdlib
|
/// dynamic_stdlib
|
||||||
/// takes configuration data and uses it to insert dynamic
|
/// takes configuration data and uses it to insert dynamic
|
||||||
/// callbacks with configuration into a symtable
|
/// callbacks with configuration into a symtable
|
||||||
pub fn dynamic_stdlib(syms: &mut SymTable, shell: Option<Rc<RefCell<posix::ShellState>>>) -> Result<(), String> {
|
#[cfg(feature="posix")]
|
||||||
//get CFG_RELISH_ENV from syms
|
pub fn dynamic_stdlib(syms: &mut SymTable, shell: Option<Rc<RefCell<posix::ShellState>>>) {
|
||||||
|
// get CFG_RELISH_ENV from syms
|
||||||
let env_cfg_user_form = syms
|
let env_cfg_user_form = syms
|
||||||
.call_symbol(&MODENV_CFG_VNAME.to_string(), &Seg::new(), true)
|
.call_symbol(&MODENV_CFG_VNAME.to_string(), &Seg::new(), true)
|
||||||
.unwrap_or_else(|_: Traceback| Box::new(Ctr::None))
|
.unwrap_or_else(|_: Traceback| Box::new(Ctr::None))
|
||||||
.to_string()
|
.to_string()
|
||||||
.eq("true");
|
.eq("true");
|
||||||
|
|
||||||
decl::add_decl_lib_dynamic(syms, env_cfg_user_form);
|
decl::add_decl_lib_dynamic(syms, env_cfg_user_form);
|
||||||
|
|
||||||
// This should be replaced by actual compiler conditionals in the future
|
|
||||||
if let Some(shell_state) = shell {
|
if let Some(shell_state) = shell {
|
||||||
let posix_cfg_user_form = syms
|
let posix_cfg_user_form = syms
|
||||||
.call_symbol(&POSIX_CFG_VNAME.to_string(), &Seg::new(), true)
|
.call_symbol(&POSIX_CFG_VNAME.to_string(), &Seg::new(), true)
|
||||||
|
|
@ -105,8 +104,11 @@ pub fn dynamic_stdlib(syms: &mut SymTable, shell: Option<Rc<RefCell<posix::Shell
|
||||||
posix::load_posix_shell(syms, shell_state);
|
posix::load_posix_shell(syms, shell_state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
#[cfg(not(feature="posix"))]
|
||||||
|
pub fn dynamic_stdlib(syms: &mut SymTable) {
|
||||||
|
decl::add_decl_lib_dynamic(syms, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load_environment(syms: &mut SymTable) {
|
pub fn load_environment(syms: &mut SymTable) {
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,8 @@ mod append_lib_tests {
|
||||||
fn test_cons_to_empty_list() {
|
fn test_cons_to_empty_list() {
|
||||||
let document = "(cons () 1)";
|
let document = "(cons () 1)";
|
||||||
let result = "(1)";
|
let result = "(1)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -24,9 +22,7 @@ mod append_lib_tests {
|
||||||
let result = "(1 'two' 3.4)";
|
let result = "(1 'two' 3.4)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -41,9 +37,7 @@ mod append_lib_tests {
|
||||||
let result = "(1 2 3)";
|
let result = "(1 2 3)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -58,9 +52,7 @@ mod append_lib_tests {
|
||||||
let result = "(<nil>)";
|
let result = "(<nil>)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -75,9 +67,7 @@ mod append_lib_tests {
|
||||||
let result = "('test' 1 2 3)";
|
let result = "('test' 1 2 3)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -92,9 +82,7 @@ mod append_lib_tests {
|
||||||
let result = "0";
|
let result = "0";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -109,9 +97,7 @@ mod append_lib_tests {
|
||||||
let result = "3";
|
let result = "3";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -125,9 +111,7 @@ mod append_lib_tests {
|
||||||
let document = "(car ())";
|
let document = "(car ())";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.err()
|
.err()
|
||||||
|
|
@ -146,9 +130,7 @@ mod append_lib_tests {
|
||||||
let result = "1";
|
let result = "1";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -162,8 +144,7 @@ mod append_lib_tests {
|
||||||
let document = "(cdr ())";
|
let document = "(cdr ())";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
|
|
@ -183,8 +164,7 @@ mod append_lib_tests {
|
||||||
let result = "3";
|
let result = "3";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
|
|
@ -203,8 +183,8 @@ mod append_lib_tests {
|
||||||
let result2 = "(2 3)";
|
let result2 = "(2 3)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
let ch1 = lex(&check1.to_string()).unwrap();
|
let ch1 = lex(&check1.to_string()).unwrap();
|
||||||
let ch2 = lex(&check2.to_string()).unwrap();
|
let ch2 = lex(&check2.to_string()).unwrap();
|
||||||
|
|
@ -229,8 +209,8 @@ mod append_lib_tests {
|
||||||
let result2 = "(<nil>)";
|
let result2 = "(<nil>)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
let ch1 = lex(&check1.to_string()).unwrap();
|
let ch1 = lex(&check1.to_string()).unwrap();
|
||||||
let ch2 = lex(&check2.to_string()).unwrap();
|
let ch2 = lex(&check2.to_string()).unwrap();
|
||||||
|
|
@ -255,8 +235,8 @@ mod append_lib_tests {
|
||||||
let result2 = "(1 2)";
|
let result2 = "(1 2)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
let ch1 = lex(&check1.to_string()).unwrap();
|
let ch1 = lex(&check1.to_string()).unwrap();
|
||||||
let ch2 = lex(&check2.to_string()).unwrap();
|
let ch2 = lex(&check2.to_string()).unwrap();
|
||||||
|
|
@ -281,8 +261,8 @@ mod append_lib_tests {
|
||||||
let result2 = "(<nil>)";
|
let result2 = "(<nil>)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
let ch1 = lex(&check1.to_string()).unwrap();
|
let ch1 = lex(&check1.to_string()).unwrap();
|
||||||
let ch2 = lex(&check2.to_string()).unwrap();
|
let ch2 = lex(&check2.to_string()).unwrap();
|
||||||
|
|
@ -304,8 +284,8 @@ mod append_lib_tests {
|
||||||
let result = "(3 2 1 'test')";
|
let result = "(3 2 1 'test')";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
|
|
@ -321,8 +301,8 @@ mod append_lib_tests {
|
||||||
let result = "('test')";
|
let result = "('test')";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
|
|
@ -338,8 +318,8 @@ mod append_lib_tests {
|
||||||
let result = "(<nil>)";
|
let result = "(<nil>)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ mod bool_lib_tests {
|
||||||
let document = "(and true true true true true)";
|
let document = "(and true true true true true)";
|
||||||
let result = "true";
|
let result = "true";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -22,8 +22,8 @@ mod bool_lib_tests {
|
||||||
let document = "(and true true false true true)";
|
let document = "(and true true false true true)";
|
||||||
let result = "false";
|
let result = "false";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -37,8 +37,8 @@ mod bool_lib_tests {
|
||||||
let document = "(and false false false false false)";
|
let document = "(and false false false false false)";
|
||||||
let result = "false";
|
let result = "false";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -52,8 +52,8 @@ mod bool_lib_tests {
|
||||||
let document = "(or true true true true true)";
|
let document = "(or true true true true true)";
|
||||||
let result = "true";
|
let result = "true";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -67,8 +67,8 @@ mod bool_lib_tests {
|
||||||
let document = "(or true true false true true)";
|
let document = "(or true true false true true)";
|
||||||
let result = "true";
|
let result = "true";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -82,8 +82,8 @@ mod bool_lib_tests {
|
||||||
let document = "(or false false false false false)";
|
let document = "(or false false false false false)";
|
||||||
let result = "false";
|
let result = "false";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -97,8 +97,8 @@ mod bool_lib_tests {
|
||||||
let document = "(not true)";
|
let document = "(not true)";
|
||||||
let result = "false";
|
let result = "false";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -114,8 +114,8 @@ mod bool_lib_tests {
|
||||||
let check = "(tester)";
|
let check = "(tester)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
let doc_tree = lex(&document.to_string()).unwrap();
|
let doc_tree = lex(&document.to_string()).unwrap();
|
||||||
let change_tree = lex(&change.to_string()).unwrap();
|
let change_tree = lex(&change.to_string()).unwrap();
|
||||||
|
|
@ -153,8 +153,8 @@ mod bool_lib_tests {
|
||||||
let check = "(tester)";
|
let check = "(tester)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
let doc_tree = lex(&document.to_string()).unwrap();
|
let doc_tree = lex(&document.to_string()).unwrap();
|
||||||
let change_tree = lex(&change.to_string()).unwrap();
|
let change_tree = lex(&change.to_string()).unwrap();
|
||||||
|
|
@ -186,8 +186,8 @@ mod bool_lib_tests {
|
||||||
let check = "(tester '1')";
|
let check = "(tester '1')";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
let doc_tree = lex(&document.to_string()).unwrap();
|
let doc_tree = lex(&document.to_string()).unwrap();
|
||||||
let change_tree = lex(&change.to_string()).unwrap();
|
let change_tree = lex(&change.to_string()).unwrap();
|
||||||
|
|
@ -216,8 +216,8 @@ mod bool_lib_tests {
|
||||||
let test = lex(&document.to_string()).unwrap();
|
let test = lex(&document.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
||||||
assert!(b)
|
assert!(b)
|
||||||
|
|
@ -232,8 +232,8 @@ mod bool_lib_tests {
|
||||||
let test = lex(&document.to_string()).unwrap();
|
let test = lex(&document.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
||||||
assert!(!b)
|
assert!(!b)
|
||||||
|
|
@ -248,8 +248,8 @@ mod bool_lib_tests {
|
||||||
let test = lex(&document.to_string()).unwrap();
|
let test = lex(&document.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
||||||
assert!(!b)
|
assert!(!b)
|
||||||
|
|
@ -264,8 +264,8 @@ mod bool_lib_tests {
|
||||||
let test = lex(&document.to_string()).unwrap();
|
let test = lex(&document.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
||||||
assert!(!b)
|
assert!(!b)
|
||||||
|
|
@ -280,8 +280,8 @@ mod bool_lib_tests {
|
||||||
let test = lex(&document.to_string()).unwrap();
|
let test = lex(&document.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
||||||
assert!(b)
|
assert!(b)
|
||||||
|
|
@ -296,8 +296,8 @@ mod bool_lib_tests {
|
||||||
let test = lex(&document.to_string()).unwrap();
|
let test = lex(&document.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
||||||
assert!(b)
|
assert!(b)
|
||||||
|
|
@ -312,8 +312,8 @@ mod bool_lib_tests {
|
||||||
let test = lex(&document.to_string()).unwrap();
|
let test = lex(&document.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
||||||
assert!(!b)
|
assert!(!b)
|
||||||
|
|
@ -328,8 +328,8 @@ mod bool_lib_tests {
|
||||||
let test = lex(&document.to_string()).unwrap();
|
let test = lex(&document.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
||||||
assert!(b)
|
assert!(b)
|
||||||
|
|
@ -344,8 +344,8 @@ mod bool_lib_tests {
|
||||||
let test = lex(&document.to_string()).unwrap();
|
let test = lex(&document.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
||||||
assert!(!b)
|
assert!(!b)
|
||||||
|
|
@ -360,8 +360,8 @@ mod bool_lib_tests {
|
||||||
let test = lex(&document.to_string()).unwrap();
|
let test = lex(&document.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
||||||
assert!(b)
|
assert!(b)
|
||||||
|
|
@ -376,8 +376,8 @@ mod bool_lib_tests {
|
||||||
let test = lex(&document.to_string()).unwrap();
|
let test = lex(&document.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
||||||
assert!(!b)
|
assert!(!b)
|
||||||
|
|
@ -392,8 +392,8 @@ mod bool_lib_tests {
|
||||||
let test = lex(&document.to_string()).unwrap();
|
let test = lex(&document.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
||||||
assert!(b)
|
assert!(b)
|
||||||
|
|
@ -408,8 +408,8 @@ mod bool_lib_tests {
|
||||||
let test = lex(&document.to_string()).unwrap();
|
let test = lex(&document.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&test, &mut syms).unwrap() {
|
||||||
assert!(!b)
|
assert!(!b)
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ mod control_lib_tests {
|
||||||
let document = "(if true 1 2)";
|
let document = "(if true 1 2)";
|
||||||
let result = 1;
|
let result = 1;
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -22,8 +22,8 @@ mod control_lib_tests {
|
||||||
let document = "(if false 1 2)";
|
let document = "(if false 1 2)";
|
||||||
let result = 2;
|
let result = 2;
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -37,8 +37,8 @@ mod control_lib_tests {
|
||||||
let document = "(if true (cons () 1) 2)";
|
let document = "(if true (cons () 1) 2)";
|
||||||
let result = "(1)";
|
let result = "(1)";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -55,8 +55,8 @@ mod control_lib_tests {
|
||||||
temp)";
|
temp)";
|
||||||
let result = "('1' '2')";
|
let result = "('1' '2')";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -74,8 +74,8 @@ mod control_lib_tests {
|
||||||
let document2 = "global";
|
let document2 = "global";
|
||||||
let result = "('hello world')";
|
let result = "('hello world')";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
eval(&lex(&document1.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&document1.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document2.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document2.to_string()).unwrap(), &mut syms)
|
||||||
|
|
@ -90,8 +90,8 @@ mod control_lib_tests {
|
||||||
let document = "(let ((temp '1')) temp (cons () temp '2'))";
|
let document = "(let ((temp '1')) temp (cons () temp '2'))";
|
||||||
let result = "('1' '2')";
|
let result = "('1' '2')";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -110,8 +110,8 @@ mod control_lib_tests {
|
||||||
|
|
||||||
let result = "('1' '2' '3')";
|
let result = "('1' '2' '3')";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -139,8 +139,8 @@ mod control_lib_tests {
|
||||||
let check_tree = lex(&test_check.to_string()).unwrap();
|
let check_tree = lex(&test_check.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&switch_tree, &mut syms).unwrap();
|
eval(&switch_tree, &mut syms).unwrap();
|
||||||
eval(&while_tree, &mut syms).unwrap();
|
eval(&while_tree, &mut syms).unwrap();
|
||||||
|
|
@ -166,8 +166,8 @@ mod control_lib_tests {
|
||||||
let check_tree = lex(&test_check.to_string()).unwrap();
|
let check_tree = lex(&test_check.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&switch_tree, &mut syms).unwrap();
|
eval(&switch_tree, &mut syms).unwrap();
|
||||||
eval(&while_tree, &mut syms).unwrap();
|
eval(&while_tree, &mut syms).unwrap();
|
||||||
|
|
@ -193,8 +193,8 @@ mod control_lib_tests {
|
||||||
let check_tree = lex(&test_check.to_string()).unwrap();
|
let check_tree = lex(&test_check.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&another_tree, &mut syms).unwrap();
|
eval(&another_tree, &mut syms).unwrap();
|
||||||
eval(&switch_tree, &mut syms).unwrap();
|
eval(&switch_tree, &mut syms).unwrap();
|
||||||
|
|
@ -211,8 +211,8 @@ mod control_lib_tests {
|
||||||
let test_tree = lex(&test.to_string()).unwrap();
|
let test_tree = lex(&test.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&doc_tree, &mut syms).unwrap();
|
eval(&doc_tree, &mut syms).unwrap();
|
||||||
let res = eval(&test_tree, &mut syms);
|
let res = eval(&test_tree, &mut syms);
|
||||||
|
|
@ -228,8 +228,8 @@ mod control_lib_tests {
|
||||||
let test_tree = lex(&test.to_string()).unwrap();
|
let test_tree = lex(&test.to_string()).unwrap();
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&doc_tree, &mut syms).unwrap();
|
eval(&doc_tree, &mut syms).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ mod decl_lib_tests {
|
||||||
let result = "(1)";
|
let result = "(1)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
let res = *eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
let res = *eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
|
|
@ -24,8 +24,8 @@ mod decl_lib_tests {
|
||||||
let result = "((1))";
|
let result = "((1))";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
let res = *eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
let res = *eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
|
|
@ -39,8 +39,8 @@ mod decl_lib_tests {
|
||||||
let result = "1";
|
let result = "1";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
let res = *eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
let res = *eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
|
|
@ -55,8 +55,8 @@ mod decl_lib_tests {
|
||||||
let result = "('2')";
|
let result = "('2')";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
|
|
@ -71,8 +71,8 @@ mod decl_lib_tests {
|
||||||
let doc3 = "(test)";
|
let doc3 = "(test)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
|
|
@ -97,8 +97,8 @@ mod decl_lib_tests {
|
||||||
let result = "('2')";
|
let result = "('2')";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
|
|
@ -116,8 +116,8 @@ mod decl_lib_tests {
|
||||||
(eq? test 'one')))";
|
(eq? test 'one')))";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
|
|
@ -135,8 +135,8 @@ mod decl_lib_tests {
|
||||||
let result = "1";
|
let result = "1";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&doc1.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
let res = *eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
let res = *eval(&lex(&doc2.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
|
|
@ -149,8 +149,8 @@ mod decl_lib_tests {
|
||||||
let doc2 = "(set? test)";
|
let doc2 = "(set? test)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
let def_tree = lex(&doc1.to_string()).unwrap();
|
let def_tree = lex(&doc1.to_string()).unwrap();
|
||||||
let set_tree = lex(&doc2.to_string()).unwrap();
|
let set_tree = lex(&doc2.to_string()).unwrap();
|
||||||
|
|
@ -164,8 +164,8 @@ mod decl_lib_tests {
|
||||||
fn test_isset_false() {
|
fn test_isset_false() {
|
||||||
let doc = "(set? test)";
|
let doc = "(set? test)";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
let set_tree = lex(&doc.to_string()).unwrap();
|
let set_tree = lex(&doc.to_string()).unwrap();
|
||||||
if let Ctr::Bool(b) = *eval(&set_tree, &mut syms).unwrap() {
|
if let Ctr::Bool(b) = *eval(&set_tree, &mut syms).unwrap() {
|
||||||
assert!(!b);
|
assert!(!b);
|
||||||
|
|
@ -178,8 +178,8 @@ mod decl_lib_tests {
|
||||||
let doc2 = "(env)";
|
let doc2 = "(env)";
|
||||||
let doc3 = "t";
|
let doc3 = "t";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
let set_tree = lex(&doc1.to_string()).unwrap();
|
let set_tree = lex(&doc1.to_string()).unwrap();
|
||||||
let env_tree = lex(&doc2.to_string()).unwrap();
|
let env_tree = lex(&doc2.to_string()).unwrap();
|
||||||
let tst_tree = lex(&doc3.to_string()).unwrap();
|
let tst_tree = lex(&doc3.to_string()).unwrap();
|
||||||
|
|
@ -193,8 +193,8 @@ mod decl_lib_tests {
|
||||||
let document = "(quote (add 1 2))";
|
let document = "(quote (add 1 2))";
|
||||||
let result = "(add 1 2)";
|
let result = "(add 1 2)";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -210,8 +210,8 @@ mod decl_lib_tests {
|
||||||
(eval stored-tree)))";
|
(eval stored-tree)))";
|
||||||
let result = "3";
|
let result = "3";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -225,8 +225,8 @@ mod decl_lib_tests {
|
||||||
let document = "(eval (1 2 3))";
|
let document = "(eval (1 2 3))";
|
||||||
let result = "(1 2 3)";
|
let result = "(1 2 3)";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -260,8 +260,8 @@ mod decl_lib_tests {
|
||||||
fn test_lambda_str_equivalency_list() {
|
fn test_lambda_str_equivalency_list() {
|
||||||
let document = "(lambda (x y) (add x y))";
|
let document = "(lambda (x y) (add x y))";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -274,8 +274,8 @@ mod decl_lib_tests {
|
||||||
fn test_lambda_str_equivalency_no_args() {
|
fn test_lambda_str_equivalency_no_args() {
|
||||||
let document = "(lambda () (add 1 2))";
|
let document = "(lambda () (add 1 2))";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -288,8 +288,8 @@ mod decl_lib_tests {
|
||||||
fn test_lambda_inline_call() {
|
fn test_lambda_inline_call() {
|
||||||
let document = "((lambda (x y) (add x y)) 1 2)";
|
let document = "((lambda (x y) (add x y)) 1 2)";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
let it = *eval(
|
let it = *eval(
|
||||||
&lex(&document.to_string()).unwrap(),
|
&lex(&document.to_string()).unwrap(),
|
||||||
&mut syms).unwrap();
|
&mut syms).unwrap();
|
||||||
|
|
@ -305,8 +305,8 @@ mod decl_lib_tests {
|
||||||
let document = "(let ((adder (lambda (x y) (add x y))))
|
let document = "(let ((adder (lambda (x y) (add x y))))
|
||||||
(adder 1 2))";
|
(adder 1 2))";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
let it = *eval(
|
let it = *eval(
|
||||||
&lex(&document.to_string()).unwrap(),
|
&lex(&document.to_string()).unwrap(),
|
||||||
&mut syms).unwrap();
|
&mut syms).unwrap();
|
||||||
|
|
@ -323,8 +323,8 @@ mod decl_lib_tests {
|
||||||
(def adder 'my adder' (lambda (x y) (add x y)))
|
(def adder 'my adder' (lambda (x y) (add x y)))
|
||||||
(adder 1 2))";
|
(adder 1 2))";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
let it = *eval(
|
let it = *eval(
|
||||||
&lex(&document.to_string()).unwrap(),
|
&lex(&document.to_string()).unwrap(),
|
||||||
&mut syms).unwrap();
|
&mut syms).unwrap();
|
||||||
|
|
@ -342,8 +342,8 @@ mod decl_lib_tests {
|
||||||
(def adder 'my adder' (lambda (x) (add x 1)))
|
(def adder 'my adder' (lambda (x) (add x 1)))
|
||||||
(appl adder 2))";
|
(appl adder 2))";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
let it = *eval(
|
let it = *eval(
|
||||||
&lex(&document.to_string()).unwrap(),
|
&lex(&document.to_string()).unwrap(),
|
||||||
&mut syms).unwrap();
|
&mut syms).unwrap();
|
||||||
|
|
@ -360,8 +360,8 @@ mod decl_lib_tests {
|
||||||
let highly_inadvisable = "(set-doc (q help) 'help')";
|
let highly_inadvisable = "(set-doc (q help) 'help')";
|
||||||
let document = "(get-doc (q help))";
|
let document = "(get-doc (q help))";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
let _ = *eval(
|
let _ = *eval(
|
||||||
&lex(&highly_inadvisable.to_string()).unwrap(),
|
&lex(&highly_inadvisable.to_string()).unwrap(),
|
||||||
&mut syms).unwrap();
|
&mut syms).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ mod math_lib_tests {
|
||||||
let result = "10";
|
let result = "10";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -24,8 +24,8 @@ mod math_lib_tests {
|
||||||
let result = "10.2";
|
let result = "10.2";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -40,8 +40,8 @@ mod math_lib_tests {
|
||||||
let result = "24";
|
let result = "24";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -56,8 +56,8 @@ mod math_lib_tests {
|
||||||
let result = "-8.2";
|
let result = "-8.2";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -72,8 +72,8 @@ mod math_lib_tests {
|
||||||
let result = "2";
|
let result = "2";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -88,8 +88,8 @@ mod math_lib_tests {
|
||||||
let result = "10";
|
let result = "10";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -104,8 +104,8 @@ mod math_lib_tests {
|
||||||
let result = "10";
|
let result = "10";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -120,8 +120,8 @@ mod math_lib_tests {
|
||||||
let result = "10";
|
let result = "10";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -136,8 +136,8 @@ mod math_lib_tests {
|
||||||
let result = "10.3";
|
let result = "10.3";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -152,8 +152,8 @@ mod math_lib_tests {
|
||||||
let result = 7i128.pow(20);
|
let result = 7i128.pow(20);
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -168,8 +168,8 @@ mod math_lib_tests {
|
||||||
let result = f64::powf(1f64, 10.2);
|
let result = f64::powf(1f64, 10.2);
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -184,8 +184,8 @@ mod math_lib_tests {
|
||||||
let result = f64::powf(1.2, 5f64);
|
let result = f64::powf(1.2, 5f64);
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -200,8 +200,8 @@ mod math_lib_tests {
|
||||||
let result = f64::powf(1.3, 1.5);
|
let result = f64::powf(1.3, 1.5);
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -219,8 +219,8 @@ mod math_lib_tests {
|
||||||
let result2 = "1";
|
let result2 = "1";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
let _ = *eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
let _ = *eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&check1.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&check1.to_string()).unwrap(), &mut syms)
|
||||||
|
|
@ -243,8 +243,8 @@ mod math_lib_tests {
|
||||||
let result1 = "2";
|
let result1 = "2";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
let _ = *eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
let _ = *eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&check1.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&check1.to_string()).unwrap(), &mut syms)
|
||||||
|
|
@ -260,8 +260,8 @@ mod math_lib_tests {
|
||||||
let check1 = "(car test)";
|
let check1 = "(car test)";
|
||||||
let result1 = "3";
|
let result1 = "3";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
let _ = *eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
let _ = *eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&check1.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&check1.to_string()).unwrap(), &mut syms)
|
||||||
|
|
@ -278,8 +278,8 @@ mod math_lib_tests {
|
||||||
let result1 = "2";
|
let result1 = "2";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
let _ = *eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
let _ = *eval(&lex(&document.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&check1.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&check1.to_string()).unwrap(), &mut syms)
|
||||||
|
|
@ -295,8 +295,8 @@ mod math_lib_tests {
|
||||||
let result = true;
|
let result = true;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -311,8 +311,8 @@ mod math_lib_tests {
|
||||||
let result = false;
|
let result = false;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -327,8 +327,8 @@ mod math_lib_tests {
|
||||||
let result = true;
|
let result = true;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -343,8 +343,8 @@ mod math_lib_tests {
|
||||||
let result = false;
|
let result = false;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -359,8 +359,8 @@ mod math_lib_tests {
|
||||||
let result = true;
|
let result = true;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -375,8 +375,8 @@ mod math_lib_tests {
|
||||||
let result = false;
|
let result = false;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -391,8 +391,8 @@ mod math_lib_tests {
|
||||||
let result = true;
|
let result = true;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -407,8 +407,8 @@ mod math_lib_tests {
|
||||||
let result = false;
|
let result = false;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -423,8 +423,8 @@ mod math_lib_tests {
|
||||||
let result = false;
|
let result = false;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -439,8 +439,8 @@ mod math_lib_tests {
|
||||||
let result = true;
|
let result = true;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -455,8 +455,8 @@ mod math_lib_tests {
|
||||||
let result = false;
|
let result = false;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -471,8 +471,8 @@ mod math_lib_tests {
|
||||||
let result = true;
|
let result = true;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -487,8 +487,8 @@ mod math_lib_tests {
|
||||||
let result = false;
|
let result = false;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -503,8 +503,8 @@ mod math_lib_tests {
|
||||||
let result = true;
|
let result = true;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -519,8 +519,8 @@ mod math_lib_tests {
|
||||||
let result = false;
|
let result = false;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -535,8 +535,8 @@ mod math_lib_tests {
|
||||||
let result = true;
|
let result = true;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -551,8 +551,8 @@ mod math_lib_tests {
|
||||||
let result = false;
|
let result = false;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -567,8 +567,8 @@ mod math_lib_tests {
|
||||||
let result = true;
|
let result = true;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -583,8 +583,8 @@ mod math_lib_tests {
|
||||||
let result = false;
|
let result = false;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -599,8 +599,8 @@ mod math_lib_tests {
|
||||||
let result = true;
|
let result = true;
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -616,8 +616,8 @@ mod math_lib_tests {
|
||||||
let check = "(tester)";
|
let check = "(tester)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
let doc_tree = lex(&document.to_string()).unwrap();
|
let doc_tree = lex(&document.to_string()).unwrap();
|
||||||
let change_tree = lex(&change.to_string()).unwrap();
|
let change_tree = lex(&change.to_string()).unwrap();
|
||||||
|
|
@ -655,8 +655,8 @@ mod math_lib_tests {
|
||||||
let check = "(tester)";
|
let check = "(tester)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
let doc_tree = lex(&document.to_string()).unwrap();
|
let doc_tree = lex(&document.to_string()).unwrap();
|
||||||
let change_tree = lex(&change.to_string()).unwrap();
|
let change_tree = lex(&change.to_string()).unwrap();
|
||||||
|
|
@ -688,8 +688,8 @@ mod math_lib_tests {
|
||||||
let check = "(tester '1')";
|
let check = "(tester '1')";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
let doc_tree = lex(&document.to_string()).unwrap();
|
let doc_tree = lex(&document.to_string()).unwrap();
|
||||||
let change_tree = lex(&change.to_string()).unwrap();
|
let change_tree = lex(&change.to_string()).unwrap();
|
||||||
|
|
@ -719,8 +719,8 @@ mod math_lib_tests {
|
||||||
let check = "(tester)";
|
let check = "(tester)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
let doc_tree = lex(&document.to_string()).unwrap();
|
let doc_tree = lex(&document.to_string()).unwrap();
|
||||||
let change_tree = lex(&change.to_string()).unwrap();
|
let change_tree = lex(&change.to_string()).unwrap();
|
||||||
|
|
@ -758,8 +758,8 @@ mod math_lib_tests {
|
||||||
let check = "(tester)";
|
let check = "(tester)";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
let doc_tree = lex(&document.to_string()).unwrap();
|
let doc_tree = lex(&document.to_string()).unwrap();
|
||||||
let change_tree = lex(&change.to_string()).unwrap();
|
let change_tree = lex(&change.to_string()).unwrap();
|
||||||
|
|
@ -791,8 +791,8 @@ mod math_lib_tests {
|
||||||
let check = "(tester '1')";
|
let check = "(tester '1')";
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
let doc_tree = lex(&document.to_string()).unwrap();
|
let doc_tree = lex(&document.to_string()).unwrap();
|
||||||
let change_tree = lex(&change.to_string()).unwrap();
|
let change_tree = lex(&change.to_string()).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ mod posix_tests {
|
||||||
let result = vec!["binary"];
|
let result = vec!["binary"];
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ok(ref s) = lex(&document.to_string()) {
|
if let Ok(ref s) = lex(&document.to_string()) {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
@ -28,8 +28,8 @@ mod posix_tests {
|
||||||
let result = vec!["binary", "--flag=1", "122", "yeet", "true"];
|
let result = vec!["binary", "--flag=1", "122", "yeet", "true"];
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ok(ref s) = lex(&document.to_string()) {
|
if let Ok(ref s) = lex(&document.to_string()) {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
@ -47,8 +47,8 @@ mod posix_tests {
|
||||||
let result = vec!["binary", "--flag=1", "122", "yeet", "true", "syms"];
|
let result = vec!["binary", "--flag=1", "122", "yeet", "true", "syms"];
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ok(ref s) = lex(&document.to_string()) {
|
if let Ok(ref s) = lex(&document.to_string()) {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
@ -67,8 +67,8 @@ mod posix_tests {
|
||||||
let result = vec!["binary", "--flag=1", "122", "yeet", "true", "1"];
|
let result = vec!["binary", "--flag=1", "122", "yeet", "true", "1"];
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
eval(&lex(&decl.to_string()).unwrap(), &mut syms).unwrap();
|
eval(&lex(&decl.to_string()).unwrap(), &mut syms).unwrap();
|
||||||
|
|
||||||
|
|
@ -88,8 +88,8 @@ mod posix_tests {
|
||||||
let result = vec!["binary", "--flag=1", "122", "yeet", "true", "3"];
|
let result = vec!["binary", "--flag=1", "122", "yeet", "true", "3"];
|
||||||
|
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
|
|
||||||
if let Ok(ref s) = lex(&document.to_string()) {
|
if let Ok(ref s) = lex(&document.to_string()) {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ mod str_lib_tests {
|
||||||
let document = "(concat 'test')";
|
let document = "(concat 'test')";
|
||||||
let result = "'test'";
|
let result = "'test'";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -22,8 +22,8 @@ mod str_lib_tests {
|
||||||
let document = "(concat 'test' 1 2 3)";
|
let document = "(concat 'test' 1 2 3)";
|
||||||
let result = "'test123'";
|
let result = "'test123'";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -37,8 +37,8 @@ mod str_lib_tests {
|
||||||
let document = "(concat)";
|
let document = "(concat)";
|
||||||
let result = "''";
|
let result = "''";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -52,8 +52,8 @@ mod str_lib_tests {
|
||||||
let document = "(strlen 'test')";
|
let document = "(strlen 'test')";
|
||||||
let result = 4;
|
let result = 4;
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -67,8 +67,8 @@ mod str_lib_tests {
|
||||||
let document = "(strlen 1000)";
|
let document = "(strlen 1000)";
|
||||||
let result = 4;
|
let result = 4;
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -82,8 +82,8 @@ mod str_lib_tests {
|
||||||
let document = "(strlen 10.2)";
|
let document = "(strlen 10.2)";
|
||||||
let result = 4;
|
let result = 4;
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -97,8 +97,8 @@ mod str_lib_tests {
|
||||||
let document = "(strlen (1 2 3))";
|
let document = "(strlen (1 2 3))";
|
||||||
let result = 7;
|
let result = 7;
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -112,8 +112,8 @@ mod str_lib_tests {
|
||||||
let document = "(strlen true)";
|
let document = "(strlen true)";
|
||||||
let result = 4;
|
let result = 4;
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -127,8 +127,8 @@ mod str_lib_tests {
|
||||||
let document = "(string 4)";
|
let document = "(string 4)";
|
||||||
let result = "'4'";
|
let result = "'4'";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -142,8 +142,8 @@ mod str_lib_tests {
|
||||||
let document = "(string (1 2 3))";
|
let document = "(string (1 2 3))";
|
||||||
let result = "'(1 2 3)'";
|
let result = "'(1 2 3)'";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -157,8 +157,8 @@ mod str_lib_tests {
|
||||||
let document = "(substr? 'bigger' 'ger')";
|
let document = "(substr? 'bigger' 'ger')";
|
||||||
let result = "true";
|
let result = "true";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -172,8 +172,8 @@ mod str_lib_tests {
|
||||||
let document = "(substr? 'smaller' 'ger')";
|
let document = "(substr? 'smaller' 'ger')";
|
||||||
let result = "false";
|
let result = "false";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -187,8 +187,8 @@ mod str_lib_tests {
|
||||||
let document = "(split 'one.two.three' '.')";
|
let document = "(split 'one.two.three' '.')";
|
||||||
let result = "('one' 'two' 'three')";
|
let result = "('one' 'two' 'three')";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -202,8 +202,8 @@ mod str_lib_tests {
|
||||||
let document = "(split 'one:d:two:d:three' ':d:')";
|
let document = "(split 'one:d:two:d:three' ':d:')";
|
||||||
let result = "('one' 'two' 'three')";
|
let result = "('one' 'two' 'three')";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -217,8 +217,8 @@ mod str_lib_tests {
|
||||||
let document = "(split 'one.two.three' '-')";
|
let document = "(split 'one.two.three' '-')";
|
||||||
let result = "('one.two.three')";
|
let result = "('one.two.three')";
|
||||||
let mut syms = SymTable::new();
|
let mut syms = SymTable::new();
|
||||||
static_stdlib(&mut syms).unwrap();
|
static_stdlib(&mut syms);
|
||||||
dynamic_stdlib(&mut syms, None).unwrap();
|
dynamic_stdlib(&mut syms, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue