From f41ab69f41c0c0ecb80669af5a37f7ae94e4ed4f Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Fri, 9 Aug 2019 16:53:43 +0000 Subject: [PATCH] Test hashed object notation. Currently busted for #[foo 123]. --- tests/runtime/test-readwrite.scm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/runtime/test-readwrite.scm b/tests/runtime/test-readwrite.scm index 7ffe76cb2..ef556bf9a 100644 --- a/tests/runtime/test-readwrite.scm +++ b/tests/runtime/test-readwrite.scm @@ -259,4 +259,21 @@ USA. (lambda (string #!optional xfail) (with-expected-failure xfail (lambda () - (assert-error (lambda () (read-from-string string))))))) \ No newline at end of file + (assert-error (lambda () (read-from-string string))))))) + +(define-structure twonky + fnord) + +(define-test 'hash + (lambda () + (let* ((object (make-twonky 123)) + (hash (hash-object object)) + (string (string-append "#[twonky " (number->string hash) "]")) + (abbrev (string-append "#@" (number->string hash)))) + (assert-equal (write-to-string object) string) + (expect-error + (lambda () + (assert-eq (eval (read-from-string string) system-global-environment) + object))) + (assert-eq (eval (read-from-string abbrev) system-global-environment) + object)))) \ No newline at end of file -- 2.25.1