master: Add a test for output-to-c-string/utf-8/lf

stassats via Sbcl-commits <[email protected]> Wed, 24 Jun 2026 20:21:06 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  f03e003693e5bcf09e947c4b35ad3912bce1bf3d (commit)
      from  0907b4329e81585c7d6ee88fe51b4ec1eb3705b5 (commit)

- Log -----------------------------------------------------------------
commit f03e003693e5bcf09e947c4b35ad3912bce1bf3d
Author: Stas Boukarev <[email protected]>
Date:   Wed Jun 24 23:20:36 2026 +0300

    Add a test for output-to-c-string/utf-8/lf
---
 tests/utf-8.pure.lisp | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tests/utf-8.pure.lisp b/tests/utf-8.pure.lisp
index 7d629b88c..0efb39948 100644
--- a/tests/utf-8.pure.lisp
+++ b/tests/utf-8.pure.lisp
@@ -522,3 +522,27 @@
     (test '(54620 0 24291 0 26085) 11)
     (test '(97 128077 98 9989 65039 65039 65039 65039 65039 65039 65039) 30)
     (test '(0 #xd800 1) nil)))
+
+#+sb-unicode
+(with-test (:name :output-to-c-string/utf-8/lf)
+  (flet ((test (chars expected &optional error-p)
+           (let ((string (map 'string #'code-char chars)))
+             (multiple-value-bind (result error)
+                 (ignore-errors (sb-impl::output-to-c-string/utf-8/lf string))
+               (if error-p
+                   (unless error
+                     (error "(sb-impl::output-to-c-string/utf-8/lf ~a) => ~a; but an error is expected"
+                            string result))
+                   (unless (and (typep result '(simple-array (unsigned-byte 8) (*)))
+                                (equalp result expected))
+                     (error "(sb-impl::output-to-c-string/utf-8/lf ~a) => ~a; but ~a is expected"
+                            chars result expected)))))))
+    (test '(97 98 99)
+          #(97 98 99 0))
+    (test '(97 224 225 226 227 228 229 65)
+          #(97 195 160 195 161 195 162 195 163 195 164 195 165 65 0))
+    (test '(54620 0 24291 0 26085)
+          #(237 149 156 0 229 187 163 0 230 151 165 0))
+    (test '(97 128077 98 9989 65039 65039 65039 65039 65039 65039 65039)
+          #(97 240 159 145 141 98 226 156 133 239 184 143 239 184 143 239 184 143 239 184 143 239 184 143 239 184 143 239 184 143 0))
+    (test '(0 #xd800 1) nil t)))

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL