edicl / cl-unicode

Portable Unicode library for Common Lisp
https://edicl.github.io/cl-unicode/
61 stars 24 forks source link

Fix test failures occuring on specific platform #17

Closed neil-lindquist closed 6 years ago

neil-lindquist commented 6 years ago

Ecl, SBCL and CMU each had failing tests, besides the missing derived properties. They all ended up being related to supporting more names from the name-char method. This resulted in names of the form U+XXXX working even when try-hex-notation-p was nil, and on CMU, Unicode 1 names working even when try-unicode1-names-p was nil.

This pull requests adjusts the behavior of character-name on those platforms to act consistently with all the other platforms, i.e. hex-notation isn't used unless try-hex-notation-p is true and unicode 1 names aren't checked unless try-unicode1-names-p is true.

stassats commented 6 years ago

If you don't want things to be different then do :try-lisp-names-p nil. Otherwise you still have SBCL: (name-char "^c") => #\Etx ECL: => NIL.

neil-lindquist commented 6 years ago

I assumed that since (null (character-named "START OF HEADING" :try-unicode1-names-p nil)) and (null (character-named "U+110000" :try-hex-notation-p t :want-code-point-p t)) were tests, that the expected behavior was to return nil in those cases.

stassats commented 6 years ago

The documented behavior is to call name-char when TRY-LISP-NAMES-P is T, so that's what is expected. The test should be adjusted.

neil-lindquist commented 6 years ago

So, this would be the prefered way to fix the failures? As opposed to my original approach in https://github.com/neil-lindquist/cl-unicode/tree/impl-char-name