]> code.delx.au - gnu-emacs/blobdiff - test/src/fns-tests.el
Use Gnulib filevercmp for version comparison
[gnu-emacs] / test / src / fns-tests.el
index 0c6edb89252bd471f2dfd2e19042d791cb51384a..861736995f41f6a9fbbc64762e16f0be1f55d3d2 100644 (file)
               a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8")))))
     '("Adrian" "Ævar" "Agustín" "Eli"))))
 
-(ert-deftest fns-tests-string-numeric-lessp ()
-  (should (string-numeric-lessp "foo2.png" "foo12.png"))
-  (should (not (string-numeric-lessp "foo12.png" "foo2.png")))
-  (should (string-numeric-lessp "foo12.png" "foo20000.png"))
-  (should (not (string-numeric-lessp "foo20000.png" "foo12.png")))
-  (should (string-numeric-lessp "foo.png" "foo2.png"))
-  (should (not (string-numeric-lessp "foo2.png" "foo.png")))
+(ert-deftest fns-tests-string-version-lessp ()
+  (should (string-version-lessp "foo2.png" "foo12.png"))
+  (should (not (string-version-lessp "foo12.png" "foo2.png")))
+  (should (string-version-lessp "foo12.png" "foo20000.png"))
+  (should (not (string-version-lessp "foo20000.png" "foo12.png")))
+  (should (string-version-lessp "foo.png" "foo2.png"))
+  (should (not (string-version-lessp "foo2.png" "foo.png")))
   (should (equal (sort '("foo12.png" "foo2.png" "foo1.png")
-                       'string-numeric-lessp)
+                       'string-version-lessp)
                  '("foo1.png" "foo2.png" "foo12.png")))
-  (should (string-numeric-lessp "foo2" "foo1234"))
-  (should (not (string-numeric-lessp "foo1234" "foo2")))
-  (should (string-numeric-lessp "foo.png" "foo2"))
-  (should (string-numeric-lessp "foo1.25.5.png" "foo1.125.5"))
-  (should (string-numeric-lessp "2" "1245"))
-  (should (not (string-numeric-lessp "1245" "2"))))
+  (should (string-version-lessp "foo2" "foo1234"))
+  (should (not (string-version-lessp "foo1234" "foo2")))
+  (should (string-version-lessp "foo.png" "foo2"))
+  (should (string-version-lessp "foo1.25.5.png" "foo1.125.5"))
+  (should (string-version-lessp "2" "1245"))
+  (should (not (string-version-lessp "1245" "2"))))