Some readme elaboration, but mostly cons

This commit is contained in:
Ava Hahn 2023-03-09 16:03:06 -08:00
parent 928c9b91ed
commit 001e35755d
Signed by untrusted user who does not match committer: affine
GPG key ID: 3A4645B8CF806069
5 changed files with 31 additions and 29 deletions

View file

@ -3,8 +3,8 @@ mod append_lib_tests {
use relish::stdlib::{dynamic_stdlib, static_stdlib};
#[test]
fn test_append_to_empty_list() {
let document = "(append () 1)";
fn test_cons_to_empty_list() {
let document = "(cons () 1)";
let result = "(1)";
let mut syms = SymTable::new();
@ -19,8 +19,8 @@ mod append_lib_tests {
}
#[test]
fn test_multi_append_to_empty_list() {
let document = "(append () 1 'two' 3.4)";
fn test_multi_cons_to_empty_list() {
let document = "(cons () 1 'two' 3.4)";
let result = "(1 'two' 3.4)";
let mut syms = SymTable::new();
@ -36,8 +36,8 @@ mod append_lib_tests {
}
#[test]
fn test_append_to_full_list() {
let document = "(append (1 2) 3)";
fn test_cons_to_full_list() {
let document = "(cons (1 2) 3)";
let result = "(1 2 3)";
let mut syms = SymTable::new();
@ -53,8 +53,8 @@ mod append_lib_tests {
}
#[test]
fn test_mono_append() {
let document = "(append)";
fn test_mono_cons() {
let document = "(cons)";
let result = "(<nil>)";
let mut syms = SymTable::new();
@ -70,8 +70,8 @@ mod append_lib_tests {
}
#[test]
fn test_append_no_list() {
let document = "(append 'test' 1 2 3)";
fn test_cons_no_list() {
let document = "(cons 'test' 1 2 3)";
let result = "('test' 1 2 3)";
let mut syms = SymTable::new();

View file

@ -34,7 +34,7 @@ mod control_lib_tests {
#[test]
fn test_complex_case_call() {
let document = "(if true (append () 1) 2)";
let document = "(if true (cons () 1) 2)";
let result = "(1)";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
@ -51,7 +51,7 @@ mod control_lib_tests {
fn test_let_multiphase_locals() {
let document = "(let (
(temp '1')
(temp (append () temp '2')))
(temp (cons () temp '2')))
temp)";
let result = "('1' '2')";
let mut syms = SymTable::new();
@ -67,7 +67,7 @@ mod control_lib_tests {
#[test]
fn test_let_multibody_evals() {
let document = "(let ((temp '1')) temp (append () temp '2'))";
let document = "(let ((temp '1')) temp (cons () temp '2'))";
let result = "('1' '2')";
let mut syms = SymTable::new();
static_stdlib(&mut syms).unwrap();
@ -84,9 +84,9 @@ mod control_lib_tests {
fn test_let_multiphase_local_multibody_evals() {
let document = "(let (
(temp '1')
(temp (append () temp '2')))
(temp (cons () temp '2')))
(echo 'first body')
(append temp '3'))";
(cons temp '3'))";
let result = "('1' '2' '3')";
let mut syms = SymTable::new();