| ... | 
... | 
@@ -5,6 +5,12 @@ | 
| 
5
 | 
5
 | 
 
  | 
| 
6
 | 
6
 | 
 (in-package "ISSUES-TESTS")
  | 
| 
7
 | 
7
 | 
 
  | 
| 
 
 | 
8
 | 
+(defparameter *test-path*
  | 
| 
 
 | 
9
 | 
+  (merge-pathnames (make-pathname :name :unspecific :type :unspecific
  | 
| 
 
 | 
10
 | 
+                                  :version :unspecific)
  | 
| 
 
 | 
11
 | 
+                   *load-truename*)
  | 
| 
 
 | 
12
 | 
+  "Path to where this file is.")
  | 
| 
 
 | 
13
 | 
+
  | 
| 
8
 | 
14
 | 
 (defun square (x)
  | 
| 
9
 | 
15
 | 
   (expt x 2))
  | 
| 
10
 | 
16
 | 
 
  | 
| ... | 
... | 
@@ -670,3 +676,50 @@ | 
| 
670
 | 
676
 | 
 		 (err (relerr value answer)))
  | 
| 
671
 | 
677
 | 
 	    (assert-true (<= err eps) base err eps)))))))
  | 
| 
672
 | 
678
 | 
 
  | 
| 
 
 | 
679
 | 
+(define-test issue.139-default-external-format
  | 
| 
 
 | 
680
 | 
+    (:tag :issues)
  | 
| 
 
 | 
681
 | 
+  (assert-eq :utf-8 stream:*default-external-format*))
  | 
| 
 
 | 
682
 | 
+
  | 
| 
 
 | 
683
 | 
+(define-test issue.139-default-external-format-read-file
  | 
| 
 
 | 
684
 | 
+    (:tag :issues)
  | 
| 
 
 | 
685
 | 
+  (let ((string (concatenate 'string
  | 
| 
 
 | 
686
 | 
+			     ;; This is "hello" in Korean
  | 
| 
 
 | 
687
 | 
+			     '(#\Hangul_syllable_an
  | 
| 
 
 | 
688
 | 
+			       #\Hangul_Syllable_Nyeong
  | 
| 
 
 | 
689
 | 
+			       #\Hangul_Syllable_Ha
  | 
| 
 
 | 
690
 | 
+			       #\Hangul_Syllable_Se
  | 
| 
 
 | 
691
 | 
+			       #\Hangul_Syllable_Yo))))
  | 
| 
 
 | 
692
 | 
+    ;; Test that opening a file for reading uses the the default :utf8
  | 
| 
 
 | 
693
 | 
+    ;; encoding.
  | 
| 
 
 | 
694
 | 
+    (with-open-file (s (merge-pathnames "utf8.txt"
  | 
| 
 
 | 
695
 | 
+					*test-path*)
  | 
| 
 
 | 
696
 | 
+		       :direction :input)
  | 
| 
 
 | 
697
 | 
+      ;; The first line should be "hello" in Hangul.
  | 
| 
 
 | 
698
 | 
+      (assert-equal (map 'list #'char-name string)
  | 
| 
 
 | 
699
 | 
+		    (map 'list #'char-name (read-line s))))))
  | 
| 
 
 | 
700
 | 
+
  | 
| 
 
 | 
701
 | 
+(define-test issue.139-default-external-format-write-file
  | 
| 
 
 | 
702
 | 
+    (:tag :issues)
  | 
| 
 
 | 
703
 | 
+  ;; Test that opening a file for writing uses the default :utf8.
  | 
| 
 
 | 
704
 | 
+  ;; First write something out to the file.  Then read it back in
  | 
| 
 
 | 
705
 | 
+  ;; using an explicit format of utf8 and verifying that we got the
  | 
| 
 
 | 
706
 | 
+  ;; right contents.
  | 
| 
 
 | 
707
 | 
+  (let ((string (concatenate 'string
  | 
| 
 
 | 
708
 | 
+			     ;; This is "hello" in Korean
  | 
| 
 
 | 
709
 | 
+			     '(#\Hangul_syllable_an
  | 
| 
 
 | 
710
 | 
+			       #\Hangul_Syllable_Nyeong
  | 
| 
 
 | 
711
 | 
+			       #\Hangul_Syllable_Ha
  | 
| 
 
 | 
712
 | 
+			       #\Hangul_Syllable_Se
  | 
| 
 
 | 
713
 | 
+			       #\Hangul_Syllable_Yo))))
  | 
| 
 
 | 
714
 | 
+    (with-open-file (s (merge-pathnames "out-utf8.txt"
  | 
| 
 
 | 
715
 | 
+					*test-path*)
  | 
| 
 
 | 
716
 | 
+		       :direction :output
  | 
| 
 
 | 
717
 | 
+		       :if-exists :supersede)
  | 
| 
 
 | 
718
 | 
+      (write-line string s))
  | 
| 
 
 | 
719
 | 
+    (with-open-file (s (merge-pathnames "out-utf8.txt"
  | 
| 
 
 | 
720
 | 
+					*test-path*)
  | 
| 
 
 | 
721
 | 
+		       :direction :input
  | 
| 
 
 | 
722
 | 
+		       :external-format :utf-8)
  | 
| 
 
 | 
723
 | 
+      (assert-equal (map 'list #'char-name string)
  | 
| 
 
 | 
724
 | 
+		    (map 'list #'char-name (read-line s))))))
  | 
| 
 
 | 
725
 | 
+    |