From 0cff026256649d52c8d3c94bc33a48ce5a5708c9 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sun, 31 Dec 2023 14:58:31 -0700 Subject: [PATCH] make failing test case for S-Expression creation/printing --- tests/123.lm | 4 +++- tests/c_cli.rs | 10 ++++++++++ tests/cons.lm | 4 ++++ tests/nil.lm | 4 ++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 tests/cons.lm create mode 100644 tests/nil.lm diff --git a/tests/123.lm b/tests/123.lm index c15168a28..666f76139 100644 --- a/tests/123.lm +++ b/tests/123.lm @@ -1,2 +1,4 @@ -main := print "123" +main := ( + print_s 123 +); diff --git a/tests/c_cli.rs b/tests/c_cli.rs index 27739303a..c9f3125b9 100644 --- a/tests/c_cli.rs +++ b/tests/c_cli.rs @@ -22,3 +22,13 @@ fn compile_and_run(fp: &str) -> String { fn cli_123() { assert_eq!( compile_and_run("tests/123.lm"), "123" ); } + +#[test] +fn cli_nil() { + assert_eq!( compile_and_run("tests/nil.lm"), "()" ); +} + +#[test] +fn cli_cons() { + assert_eq!( compile_and_run("tests/cons.lm"), "(123 . (() . 456))" ); +} diff --git a/tests/cons.lm b/tests/cons.lm new file mode 100644 index 000000000..190dc3627 --- /dev/null +++ b/tests/cons.lm @@ -0,0 +1,4 @@ + +main := ( + print_s (123 () 456) +); diff --git a/tests/nil.lm b/tests/nil.lm new file mode 100644 index 000000000..024fe57d1 --- /dev/null +++ b/tests/nil.lm @@ -0,0 +1,4 @@ + +main := ( + print_s () +);