diff options
-rw-r--r-- | src/data.c | 4 | ||||
-rw-r--r-- | test/src/data-tests.el | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/data.c b/src/data.c index 29547d8a9ba..c480ed2068a 100644 --- a/src/data.c +++ b/src/data.c @@ -2972,9 +2972,9 @@ minmax_driver (ptrdiff_t nargs, Lisp_Object *args, if (argnum == 0 || !NILP (arithcompare (val, accum, comparison))) accum = val; else if (FLOATP (accum) && isnan (XFLOAT_DATA (accum))) - break; + return accum; } - return accum; + return MARKERP (accum) ? make_number (marker_position (accum)) : accum; } DEFUN ("max", Fmax, Smax, 1, MANY, 0, diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 70ffdabe4d4..67d00a7f930 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -88,7 +88,9 @@ (should (= (1+ most-negative-fixnum) (max (float most-negative-fixnum) (1+ most-negative-fixnum)))) (should (= 8 (apply #'max '(3 8 3)))) - (should-error (max 9 8 'foo))) + (should-error (max 9 8 'foo)) + (should-error (max (make-marker))) + (should (eql 1 (max (point-min-marker) 1)))) (ert-deftest data-tests-min () (should-error (min)) @@ -98,7 +100,9 @@ (should (= most-positive-fixnum (min (+ 1.0 most-positive-fixnum) most-positive-fixnum))) (should (= 3 (apply #'min '(3 8 3)))) - (should-error (min 9 8 'foo))) + (should-error (min 9 8 'foo)) + (should-error (min (make-marker))) + (should (eql 1 (min (point-min-marker) 1)))) ;; Bool vector tests. Compactly represent bool vectors as hex ;; strings. |