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:
Ava Apples Affine 2023-05-26 06:41:18 +00:00
parent 5e15109b0c
commit 906cb16355
13 changed files with 330 additions and 319 deletions

View file

@ -9,8 +9,8 @@ mod decl_lib_tests {
let result = "(1)";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
eval(&lex(&doc1.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 mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
eval(&lex(&doc1.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 mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
eval(&lex(&doc1.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 mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
eval(&lex(&doc1.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 mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
eval(&lex(&doc1.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 mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
eval(&lex(&doc1.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')))";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
eval(&lex(&doc1.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 mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
eval(&lex(&doc1.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 mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
let def_tree = lex(&doc1.to_string()).unwrap();
let set_tree = lex(&doc2.to_string()).unwrap();
@ -164,8 +164,8 @@ mod decl_lib_tests {
fn test_isset_false() {
let doc = "(set? test)";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
let set_tree = lex(&doc.to_string()).unwrap();
if let Ctr::Bool(b) = *eval(&set_tree, &mut syms).unwrap() {
assert!(!b);
@ -178,8 +178,8 @@ mod decl_lib_tests {
let doc2 = "(env)";
let doc3 = "t";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
let set_tree = lex(&doc1.to_string()).unwrap();
let env_tree = lex(&doc2.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 result = "(add 1 2)";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
@ -210,8 +210,8 @@ mod decl_lib_tests {
(eval stored-tree)))";
let result = "3";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
@ -225,8 +225,8 @@ mod decl_lib_tests {
let document = "(eval (1 2 3))";
let result = "(1 2 3)";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
@ -260,8 +260,8 @@ mod decl_lib_tests {
fn test_lambda_str_equivalency_list() {
let document = "(lambda (x y) (add x y))";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
@ -274,8 +274,8 @@ mod decl_lib_tests {
fn test_lambda_str_equivalency_no_args() {
let document = "(lambda () (add 1 2))";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
assert_eq!(
*eval(&lex(&document.to_string()).unwrap(), &mut syms)
.unwrap()
@ -288,8 +288,8 @@ mod decl_lib_tests {
fn test_lambda_inline_call() {
let document = "((lambda (x y) (add x y)) 1 2)";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
let it = *eval(
&lex(&document.to_string()).unwrap(),
&mut syms).unwrap();
@ -305,8 +305,8 @@ mod decl_lib_tests {
let document = "(let ((adder (lambda (x y) (add x y))))
(adder 1 2))";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
let it = *eval(
&lex(&document.to_string()).unwrap(),
&mut syms).unwrap();
@ -323,8 +323,8 @@ mod decl_lib_tests {
(def adder 'my adder' (lambda (x y) (add x y)))
(adder 1 2))";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
let it = *eval(
&lex(&document.to_string()).unwrap(),
&mut syms).unwrap();
@ -342,8 +342,8 @@ mod decl_lib_tests {
(def adder 'my adder' (lambda (x) (add x 1)))
(appl adder 2))";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
let it = *eval(
&lex(&document.to_string()).unwrap(),
&mut syms).unwrap();
@ -360,8 +360,8 @@ mod decl_lib_tests {
let highly_inadvisable = "(set-doc (q help) 'help')";
let document = "(get-doc (q help))";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
dynamic_stdlib(&mut syms, None).unwrap();
static_stdlib(&mut syms);
dynamic_stdlib(&mut syms, None);
let _ = *eval(
&lex(&highly_inadvisable.to_string()).unwrap(),
&mut syms).unwrap();