Adjust tests to match changes to unicode-scalar-value?.
authorChris Hanson <org/chris-hanson/cph>
Mon, 30 Jan 2017 02:02:38 +0000 (18:02 -0800)
committerChris Hanson <org/chris-hanson/cph>
Mon, 30 Jan 2017 02:02:38 +0000 (18:02 -0800)
Also add checks of unicode-code-point?.

tests/runtime/test-char.scm

index e8705a63dd316dbe831805681b2888b6c45ea64f..82b99ff929f48f6f7769a02c023aed0a85a7a8c2 100644 (file)
@@ -164,13 +164,28 @@ USA.
 (define-test 'illegal-chars
   (lambda ()
     (for-each (lambda (cp)
-               (assert-false (unicode-scalar-value? cp))
+               (value-assert (lambda (cp)
+                                (not (unicode-scalar-value? cp)))
+                              "non-scalar value"
+                              cp))
+              utf16-surrogates)
+    (for-each (lambda (cp)
+               (value-assert unicode-scalar-value? "scalar value" cp))
+              illegal-characters)
+    (for-each (lambda (cp)
+               (value-assert unicode-code-point? "code point" cp)
                (let ((char (integer->char cp)))
-                 (assert-false (unicode-char? char))
+                  (value-assert (lambda (char)
+                                  (not (unicode-char? char)))
+                                "non-unicode character"
+                                char)
                  (assert-error
                   (lambda ()
                     (encode-utf8-char! (make-bytevector 16) 0 char)))))
-             illegal-characters)))
+             (append utf16-surrogates illegal-characters))))
+
+(define utf16-surrogates
+  (iota #x800 #xD800))
 
 (define illegal-characters
   `(
@@ -180,7 +195,7 @@ USA.
                    (let ((prefix (* plane #x10000)))
                      (list (+ prefix #xFFFE)
                            (+ prefix #xFFFF))))
-                 (iota #x11 #x01))
+                 (iota #x11))
     ))
 \f
 (define-test 'invalid-utf8-sequences