klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

commit 9ac27a088b3bc4b16a842c8d941599b3988f4286
parent 43243b088c06945d29f360a967ff20bb29f09e36
Author: Oto Havle <havleoto@gmail.com>
Date:   Sun, 23 Oct 2011 12:53:34 +0200

Added tests of string->symbol and symbol->strings. Added  to test-helpers.k

Diffstat:
Msrc/tests/strings.k | 18+++++++++++++++++-
Msrc/tests/test-helpers.k | 4++++
2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/tests/strings.k b/src/tests/strings.k @@ -193,4 +193,20 @@ ($check-predicate (nonempty-mutable-string? (list->string (list #\a #\b)))) -($check-error (list->string (($vau (x) #ignore x) (#\a #0=(#\a . #0#))))) +($check-error (list->string ($quote (#\a #0=(#\a . #0#))))) + +;; 13.1.1 string->symbol +;; XXX symbol->string +;; + +($check-predicate (symbol? (string->symbol "abcd"))) +($check-predicate (symbol? (string->symbol ""))) +($check-predicate (symbol? (string->symbol "0"))) +($check-predicate (symbol? (string->symbol "#inert"))) + +($check equal? (string->symbol "abcd") ($quote abcd)) +($check equal? (symbol->string ($quote abcd)) "abcd") + +($check equal? + ($quote sym) + (string->symbol (symbol->string ($quote sym)))) diff --git a/src/tests/test-helpers.k b/src/tests/test-helpers.k @@ -77,3 +77,7 @@ (apply and? (map ($lambda ((x y)) (not? (eval (list p x y) denv))) (cartesian-product xs ys))))) + +;; ($quote V) evaluates to V. The value V itself is not evaluated. +;; See section 5.5.1, page 67 of the Kernel Report. +($define! $quote ($vau (x) #ignore x))