From 16c6a9a5e47681c824a4f393db1374a0ec6ccfa7 Mon Sep 17 00:00:00 2001
From: Taylor R Campbell <campbell@mumble.net>
Date: Mon, 18 Feb 2013 15:11:04 +0000
Subject: [PATCH] Unparse the symbol whose name is `.' as `|.|'.

Add a trivial test for it.

Found by Pavel Panchekha.
---
 src/runtime/unpars.scm           |  3 ++-
 tests/check.scm                  |  1 +
 tests/runtime/test-readwrite.scm | 33 ++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 tests/runtime/test-readwrite.scm

diff --git a/src/runtime/unpars.scm b/src/runtime/unpars.scm
index 502ad1f16..016ca0986 100644
--- a/src/runtime/unpars.scm
+++ b/src/runtime/unpars.scm
@@ -362,7 +362,8 @@ USA.
 	       (string->number s))
 	  (and (fix:> (string-length s) 1)
 	       (or (looks-special? s)
-		   (looks-like-keyword? s))))
+		   (looks-like-keyword? s)))
+	  (string=? s "."))
       (begin
 	(*unparse-char #\|)
 	(let ((end (string-length s)))
diff --git a/tests/check.scm b/tests/check.scm
index bc6e5d12d..37905c555 100644
--- a/tests/check.scm
+++ b/tests/check.scm
@@ -49,6 +49,7 @@ USA.
     "runtime/test-integer-bits"
     "runtime/test-thread-queue"
     "runtime/test-process"
+    "runtime/test-readwrite"
     "runtime/test-regsexp"
     ("runtime/test-wttree" (runtime wt-tree))
     ;;"ffi/test-ffi"
diff --git a/tests/runtime/test-readwrite.scm b/tests/runtime/test-readwrite.scm
new file mode 100644
index 000000000..24861fb1d
--- /dev/null
+++ b/tests/runtime/test-readwrite.scm
@@ -0,0 +1,33 @@
+#| -*-Scheme-*-
+
+Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+    1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+    2006, 2007, 2008, 2009, 2010, 2011, 2012 Massachusetts Institute
+    of Technology
+
+This file is part of MIT/GNU Scheme.
+
+MIT/GNU Scheme is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+MIT/GNU Scheme is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with MIT/GNU Scheme; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+USA.
+
+|#
+
+;;;; Tests for READ and WRITE
+
+(declare (usual-integrations))
+
+(define-test 'DOT-SYMBOL-GETS-BARS
+  (lambda ()
+    (assert-equal (write-to-string (string->symbol ".")) "|.|")))
-- 
2.25.1