aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorPaul Eggert2016-02-21 13:25:24 -0800
committerPaul Eggert2016-02-21 13:27:40 -0800
commit1f7feecaee0ed3fb79758fe60020aefb30d9ff01 (patch)
treeb0476096aabea32658be041242caa74e7a5232cd /test/src
parent3e67708d7239cde24b0988d4d1288bc75585cfea (diff)
downloademacs-1f7feecaee0ed3fb79758fe60020aefb30d9ff01.tar.gz
emacs-1f7feecaee0ed3fb79758fe60020aefb30d9ff01.zip
Use Gnulib filevercmp for version comparison
* admin/merge-gnulib (GNULIB_MODULES): Add filevercmp. * doc/lispref/strings.texi (Text Comparison): * etc/NEWS, src/fns.c: * test/src/fns-tests.el (fns-tests-string-version-lessp): Rename newly-introduced function to string-version-lessp, by analogy with strverscmp. * lib/filevercmp.c, lib/filevercmp.h: New files, copied from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * src/fns.c: Include <filevercmp.h>. (gather_number_from_string): Remove. (Fstring_version_lessp): Reimplement via filevercmp.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/fns-tests.el28
1 files changed, 14 insertions, 14 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index 0c6edb89252..861736995f4 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -192,19 +192,19 @@
192 a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))))) 192 a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8")))))
193 '("Adrian" "Ævar" "Agustín" "Eli")))) 193 '("Adrian" "Ævar" "Agustín" "Eli"))))
194 194
195(ert-deftest fns-tests-string-numeric-lessp () 195(ert-deftest fns-tests-string-version-lessp ()
196 (should (string-numeric-lessp "foo2.png" "foo12.png")) 196 (should (string-version-lessp "foo2.png" "foo12.png"))
197 (should (not (string-numeric-lessp "foo12.png" "foo2.png"))) 197 (should (not (string-version-lessp "foo12.png" "foo2.png")))
198 (should (string-numeric-lessp "foo12.png" "foo20000.png")) 198 (should (string-version-lessp "foo12.png" "foo20000.png"))
199 (should (not (string-numeric-lessp "foo20000.png" "foo12.png"))) 199 (should (not (string-version-lessp "foo20000.png" "foo12.png")))
200 (should (string-numeric-lessp "foo.png" "foo2.png")) 200 (should (string-version-lessp "foo.png" "foo2.png"))
201 (should (not (string-numeric-lessp "foo2.png" "foo.png"))) 201 (should (not (string-version-lessp "foo2.png" "foo.png")))
202 (should (equal (sort '("foo12.png" "foo2.png" "foo1.png") 202 (should (equal (sort '("foo12.png" "foo2.png" "foo1.png")
203 'string-numeric-lessp) 203 'string-version-lessp)
204 '("foo1.png" "foo2.png" "foo12.png"))) 204 '("foo1.png" "foo2.png" "foo12.png")))
205 (should (string-numeric-lessp "foo2" "foo1234")) 205 (should (string-version-lessp "foo2" "foo1234"))
206 (should (not (string-numeric-lessp "foo1234" "foo2"))) 206 (should (not (string-version-lessp "foo1234" "foo2")))
207 (should (string-numeric-lessp "foo.png" "foo2")) 207 (should (string-version-lessp "foo.png" "foo2"))
208 (should (string-numeric-lessp "foo1.25.5.png" "foo1.125.5")) 208 (should (string-version-lessp "foo1.25.5.png" "foo1.125.5"))
209 (should (string-numeric-lessp "2" "1245")) 209 (should (string-version-lessp "2" "1245"))
210 (should (not (string-numeric-lessp "1245" "2")))) 210 (should (not (string-version-lessp "1245" "2"))))