Subject: bug#26457: 25.2; Cannot pass a function to imenu-generic-expression

From: Nicolas Petton <[email-masked]>
Date: Wed, 12 Apr 2017 10:24:34 +0200

Damien Cassou <[email-masked]> writes:

>  (defun imenu--sort-by-position (item1 item2)
> -  (< (cdr item1) (cdr item2)))
> +  "Comparison function to sort items depending on their position.
> +Return t if and only if ITEM1's position is lower than ITEM2's
          ^^        
          We usually say "non-nil".

> +(ert-deftest imenu--sort-by-position-pairs ()
> +  (should (imenu--sort-by-position '("a" . 2) '("a" . 3)))
> +  (should-not (imenu--sort-by-position '("a" . 3) '("a" . 2))))
> +
> +;; Regression test for bug#26457: 25.2; Cannot pass a function to
> +;; imenu-generic-expression
> +(ert-deftest imenu--sort-by-position-list ()
> +  (should (imenu--sort-by-position '("a" 2 nil) '("a" 3 nil)))
> +  (should-not (imenu--sort-by-position '("a" 3 nil) '("a" 2 nil))))

Thanks for the regression test!

Cheers,
Nico