Raymond Toy pushed to branch issue-158-darwin-pathnames-utf8 at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • tests/issues.lisp
    ... ... @@ -826,3 +826,49 @@
    826 826
     	(*compile-print* nil))
    
    827 827
         (assert-true (stream::find-external-format :euckr))
    
    828 828
         (assert-true (stream::find-external-format :cp949))))
    
    829
    +
    
    830
    +(define-test issue.158
    
    831
    +    (:tag :issues)
    
    832
    +  (let* ((name (string #\Hangul_Syllable_Gyek))
    
    833
    +	 (path (make-pathname :directory (list :relative name)
    
    834
    +			      :name name
    
    835
    +			      :type name)))
    
    836
    +    #+darwin
    
    837
    +    (let ((expected '(4352 4456 4543)))
    
    838
    +      ;; Tests that on Darwin the Hangul pathname has been normalized
    
    839
    +      ;; correctly.  We fill in the directory, name, and type components
    
    840
    +      ;; with the same thing since it shouldn't really matter.
    
    841
    +      ;;
    
    842
    +      ;; The expected value is the conjoining jamo for the character
    
    843
    +      ;; #\Hangul_Syllable_Gyek.
    
    844
    +      (assert-equal (map 'list #'char-code (second (pathname-directory path)))
    
    845
    +		    expected)
    
    846
    +      (assert-equal (map 'list #'char-code (pathname-name path))
    
    847
    +		    expected)
    
    848
    +      (assert-equal (map 'list #'char-code (pathname-type path))
    
    849
    +		    expected))
    
    850
    +    #-darwin
    
    851
    +    (let ((expected (list (char-code #\Hangul_Syllable_Gyek))))
    
    852
    +      ;; For other OSes, just assume that the pathname is unchanged.
    
    853
    +      (assert-equal (map 'list #'char-code (second (pathname-directory path)))
    
    854
    +		    expected)
    
    855
    +      (assert-equal (map 'list #'char-code (pathname-name path))
    
    856
    +		    expected)
    
    857
    +      (assert-equal (map 'list #'char-code (pathname-type path))
    
    858
    +		    expected))))
    
    859
    +
    
    860
    +(define-test issue.158.dir
    
    861
    +    (:tag :issues)
    
    862
    +  (flet ((get-file ()
    
    863
    +	   ;; This assumes that there is only one file in resources/darwin
    
    864
    +	   (let ((files (directory "resources/darwin/*.txt")))
    
    865
    +	     (assert-equal (length files) 1)
    
    866
    +	     (first files))))
    
    867
    +    (let ((f (get-file))
    
    868
    +	  (expected-name "안녕하십니까"))
    
    869
    +      #+darwin
    
    870
    +      (assert-equal (pathname-name f)
    
    871
    +		    (unicode::decompose-hangul expected-name))
    
    872
    +      #-darwin
    
    873
    +      (assert-equal (pathname-name f) expected-name))))
    
    874
    +    

  • tests/resources/darwin/안녕하십니까.txt
    1
    +The file name of this file is "안녕하십니까.txt" ("Hello" in Korean.)
    
    2
    +
    
    3
    +