emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* test-org-table/sort-lines: Failing test on macOS
@ 2022-10-06 20:15 Rudolf Adamkovič
  2022-10-07 12:04 ` Max Nikulin
  0 siblings, 1 reply; 27+ messages in thread
From: Rudolf Adamkovič @ 2022-10-06 20:15 UTC (permalink / raw)
  To: emacs-orgmode

Howdy, howdy!

I see the test failure below on macOS.

Test test-org-table/sort-lines condition:

  (ert-test-failed
   ((should
     (equal "| a | x |\n| B | 4 |\n| c | 3 |\n"
            (org-test-with-temp-text "| <point>a | x |\n| c | 3 |\n| B | 4 |\n"
            ... ...)))
    :form
    (equal "| a | x |\n| B | 4 |\n| c | 3 |\n"
           #("| B | 4 |\n| a | x |\n| c | 3 |\n" 0 9
             (face org-table)
             10 19
             (face org-table)
             20 29
             (face org-table)))
    :value nil :explanation
    (array-elt 2
               (different-atoms
                (97 "#x61" "?a")
                (66 "#x42" "?B")))))
 FAILED  796/952  test-org-table/sort-lines (0.003410 sec)
   at ../lisp/test-org-table.el:1880

The isolated part of the test file that fails:

(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" nil))))
    (should
     (equal "| a | x |\n| B | 4 |\n| c | 3 |\n"
            (org-test-with-temp-text "| <point>a | x |\n| c | 3 |\n| B | 4 |\n"
                                     (org-table-sort-lines nil ?a)
                                     (buffer-string))))))

If I understand, "a" should be less than "B" when under "C" locale when
ignoring case (nil) , right?  Yet, I get the following:

(string-collate-lessp "a" "B" "C" nil)  ; => nil

[FYI: If I replace nil with t, the procedure returns nil too.]

Tested on Emacs 29 (adaa2fc90e) and Org 9.5.5 (580f28614).

Rudy
-- 
"It is no paradox to say that in our most theoretical moods we may be
nearest to our most practical applications."
-- Alfred North Whitehead, 1861-1947

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2024-05-11  9:38 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-06 20:15 test-org-table/sort-lines: Failing test on macOS Rudolf Adamkovič
2022-10-07 12:04 ` Max Nikulin
2022-10-08  5:25   ` Ihor Radchenko
2022-10-08 14:27     ` Max Nikulin
2022-10-09  3:59       ` Ihor Radchenko
2022-10-09 15:38         ` Rudolf Adamkovič
2022-10-09 16:53           ` Max Nikulin
2022-10-10 22:25             ` Rudolf Adamkovič
2022-10-12 16:09               ` Max Nikulin
2022-11-15  4:10                 ` Ihor Radchenko
2022-11-20  4:18                   ` Ihor Radchenko
2022-11-20  8:00                     ` Max Nikulin
2022-11-21  3:15                       ` Ihor Radchenko
2022-11-21 16:48                         ` Max Nikulin
2022-11-22  1:14                           ` Ihor Radchenko
2022-11-22 16:01                             ` Max Nikulin
2022-11-23 10:37                               ` Ihor Radchenko
2022-11-23 15:27                                 ` Max Nikulin
2022-11-23 17:01                                   ` Max Nikulin
2022-11-26  2:05                                   ` Ihor Radchenko
2022-11-29 16:40                                     ` Max Nikulin
2024-04-03 11:40                                       ` [DISCUSSION] Sorting strings in Org mode vs. system locale (was: test-org-table/sort-lines: Failing test on macOS) Ihor Radchenko
2024-05-05 11:59                                         ` Ihor Radchenko
2024-05-07 11:06                                           ` [DISCUSSION] Sorting strings in Org mode vs. system locale Max Nikulin
2024-05-07 13:09                                             ` Ihor Radchenko
2024-05-07 16:47                                               ` Max Nikulin
2024-05-11  9:38                                                 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).