[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Patch] to correctly sort the items with emphasis marks in a list
From: |
Maxim Nikulin |
Subject: |
Re: [Patch] to correctly sort the items with emphasis marks in a list |
Date: |
Tue, 20 Apr 2021 19:37:46 +0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 |
On 20/04/2021 00:50, Nicolas Goaziou wrote:
Maxim Nikulin writes:
On 19/04/2021 23:08, Nicolas Goaziou wrote:
+ ;; Space role in sorting.
+ ;; Test would fail for locales with ignored space, e.g. en_US, it works
+ ;; in C and currently rare locales having significant space (es_ES,
pl_PL)
+ (should
+ (equal "- Time stamp\n- Timer\n"
+ (org-test-with-temp-text "- Timer\n- Time stamp\n"
+ (org-sort-list t ?a)
+ (buffer-string))))))
Since this test is bound to fail for some developers, I assume it
shouldn't be included.
Locale "C" is forced for this group of tests.
Sorry, I don't understand. There is no locale change around this test,
so it will fail, for example, for me. I wouldn't want to get a noisy
failure each time I run tests.
Certainly flaky tests must be avoided. However I can not identify the
source of confusion (yours or mine).
There is redefinition of `string-collate-lessp' to run tests with "C"
locale:
https://code.orgmode.org/bzg/org-mode/src/master/testing/lisp/test-org-list.el#L1207
And it works for me
#+begin_src elisp
(let ((original-string-collate-lessp (symbol-function
#'string-collate-lessp)))
(cl-letf (((symbol-function 'string-collate-lessp)
(lambda (s1 s2 &optional locale ignore-case)
(funcall original-string-collate-lessp
s1 s2 "C" ignore-case))))
(org-test-with-temp-text "- Timer\n- Time stamp\n"
(org-sort-list t ?a)
(buffer-string))))
#+end_src
#+RESULTS:
: - Time stamp
: - Timer
#+begin_src elisp
(let ((original-string-collate-lessp (symbol-function
#'string-collate-lessp)))
(cl-letf (((symbol-function 'string-collate-lessp)
(lambda (s1 s2 &optional locale ignore-case)
(funcall original-string-collate-lessp
s1 s2 "en_US.UTF-8" ignore-case))))
(org-test-with-temp-text "- Timer\n- Time stamp\n"
(org-sort-list t ?a)
(buffer-string))))
#+end_src
#+RESULTS:
: - Timer
: - Time stamp
glibc-2.31 (source for locales package), Ubuntu-20.04 focal, emacs-26.3
Could you, please, show result of the following command in your
environment (for a chance that "C" locale definition has changed):
printf 'Timestamp\nTime zone\n' \
| LC_ALL= LC_COLLATE= LANG=C.UTF-8 LANGUAGE=en sort --debug
sort: using ‘C.UTF-8’ sorting rules
Time zone
_________
Timestamp
_________
- Re: [Patch] to correctly sort the items with emphasis marks in a list, (continued)
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/18
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/18
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Nicolas Goaziou, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Nicolas Goaziou, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Greg Minshall, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Tom Gillespie, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Greg Minshall, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Nicolas Goaziou, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list,
Maxim Nikulin <=
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/20
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Nicolas Goaziou, 2021/04/20
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/20
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Nicolas Goaziou, 2021/04/20
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/21
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/21
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/24
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Bastien, 2021/04/28
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Nicolas Goaziou, 2021/04/28
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Bastien, 2021/04/28