X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Ftest-i18n.lisp;h=b00c6d5529b028763cf458c719be2a509ff17ec1;hb=2fb4a4ccc311f37b0f5e993976a4d7d4f667f4e3;hp=6374a3f00158693982043ffce531614cd672fd15;hpb=f26d09724b4aa3d6bc8eae35582c8b15b9b3f5da;p=clsql.git diff --git a/tests/test-i18n.lisp b/tests/test-i18n.lisp index 6374a3f..b00c6d5 100644 --- a/tests/test-i18n.lisp +++ b/tests/test-i18n.lisp @@ -4,10 +4,10 @@ ;;;; ;;;; Name: test-i18n.lisp ;;;; Purpose: Tests for passing non-ascii encoded strings to db and back -;;;; Author: Nathan Bird +;;;; Author: Nathan Bird & Kevin M. Rosenberg ;;;; Created: Feb 2010 ;;;; -;;;; This file, part of CLSQL, is Copyright (c) 2002-2010 by Kevin M. Rosenberg +;;;; This file is part of CLSQL. ;;;; ;;;; CLSQL users are granted the rights to distribute and use this software ;;;; as governed by the terms of the Lisp Lesser GNU Public License @@ -23,15 +23,30 @@ ;;; UTF-8 for example can handle these easily. ;; I show this as a 20char string and 27 bytes in utf-8 (deftest :basic/i18n/1 - (first (query "SELECT 'Iñtërnâtiônàlizætiøn'" - :flatp t :field-names nil)) - "Iñtërnâtiônàlizætiøn") + (let ((uffi:*default-foreign-encoding* :utf-8)) + (first (query "SELECT 'Iñtërnâtiônàlizætiøn'" + :flatp t :field-names nil))) + "Iñtërnâtiônàlizætiøn") ;; the z in this one is even stronger ;; I show this as a 20char string and 28 bytes in utf-8 (deftest :basic/i18n/2 - (first (query "SELECT 'Iñtërnâtiônàližætiøn'" - :flatp t :field-names nil)) - "Iñtërnâtiônàližætiøn") + (let ((uffi:*default-foreign-encoding* :utf-8)) + (first (query "SELECT 'Iñtërnâtiônàližætiøn'" + :flatp t :field-names nil))) + "Iñtërnâtiônàližætiøn") + +(deftest :basic/i18n/big/1 + (let ((test-string (with-output-to-string (str) + (dotimes (n 250) + (write-sequence "Iñtërnâtiônàližætiøn" str))))) + (with-dataset *ds-bigtext* + (clsql-sys:execute-command + (format nil + "INSERT INTO testbigtext (a) VALUES ('~a')" + test-string)) + (let ((res (first (clsql:query "SELECT a from testbigtext" :flatp t :field-names nil)))) + (assert (equal test-string res) (test-string res) + "Returned internationalization string was incorrect. Test :basic/i18n/big/1"))))) ))