From 9899a8b678f834e7d0ccf626d2c75ee50cd09653 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Wed, 5 Jul 2023 08:12:27 +0100 Subject: [PATCH] SUBLIS test still breaking, CONC test still failing, otherwise good. I'm now convinced that the reason for the SUBLIS fail is a misprint in the manual! --- .gitignore | 2 ++ .portal/vs-code.edn | 1 - src/beowulf/bootstrap.clj | 2 +- test/beowulf/lisp_test.clj | 30 +++++++++++++++++++----------- 4 files changed, 22 insertions(+), 13 deletions(-) delete mode 100644 .portal/vs-code.edn diff --git a/.gitignore b/.gitignore index fc2a440..795f8a4 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ Sysout*.lsp src/beowulf/scratch.clj .portal/vs-code.edn + +.portal/ diff --git a/.portal/vs-code.edn b/.portal/vs-code.edn deleted file mode 100644 index fde814a..0000000 --- a/.portal/vs-code.edn +++ /dev/null @@ -1 +0,0 @@ -{:host "localhost", :port 62056} \ No newline at end of file diff --git a/src/beowulf/bootstrap.clj b/src/beowulf/bootstrap.clj index f20837d..7f4ed1a 100644 --- a/src/beowulf/bootstrap.clj +++ b/src/beowulf/bootstrap.clj @@ -443,7 +443,7 @@ (println (str indent ": EVAL: deóp bindele: (" expr " . " (or v' "nil") ")"))) (if v' v' - (throw (ex-info "Ne tácen-bindele āfand" + (throw (ex-info (format "Ne tácen-bindele āfand: `%s`" expr) {:phase :eval :function 'EVAL :args (list expr env depth) diff --git a/test/beowulf/lisp_test.clj b/test/beowulf/lisp_test.clj index e50f6c9..98bcc39 100644 --- a/test/beowulf/lisp_test.clj +++ b/test/beowulf/lisp_test.clj @@ -130,7 +130,6 @@ actual (reps input)] (is (= actual expected)))))) - (deftest MEMBER-tests (testing "member" (let [expected "T" @@ -147,17 +146,15 @@ (is (= actual expected))))) ;; This is failing, and although yes, it does matter, I have not yet tracked the reason. -;; (deftest sublis-tests -;; (testing "sublis" -;; (let [expected "(SHAKESPEARE WROTE (THE TEMPEST))" -;; actual (reps -;; "(SUBLIS -;; '((X . SHAKESPEARE) (Y . (THE TEMPEST))) -;; '(X WROTE Y))")] -;; (is (= actual expected))))) +(deftest sublis-tests + (testing "sublis" + (let [expected "(SHAKESPEARE WROTE (THE TEMPEST))" + actual (reps + "(SUBLIS + '((X . SHAKESPEARE) (Y . (THE TEMPEST))) + '(X WROTE Y))")] + (is (= actual expected))))) -;; this works just fine in the REPL provided PROG is traced, but does not work -;; if PROG is not traced (and doesn't work in the test harness either way) (deftest prog-tests (testing "PROG" ;; (reps "(TRACE 'PROG)") @@ -215,3 +212,14 @@ (let [expected "(1 2 3 4 5 6 7 8 9 10 11 12)" actual (reps "(CONC P Q R)")] (is (= actual expected))))) + +(deftest attrib-tests + (testing "ATTRIB" + (reps "(SETQ X '(A B C))") + (reps "(SETQ Y '(D E F))") + (let [expected "(D E F)" + actual (reps "(ATTRIB X Y)")] + (is (= actual expected))) + (let [expected "(A B C D E F)" + actual (reps "X")] + (is (= actual expected))))) \ No newline at end of file