From f9c28c08c5f381040fb6ebfbcae05d18b841c057 Mon Sep 17 00:00:00 2001 From: Felix Winkelmann Date: Mon, 17 Sep 2018 10:01:53 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20broken=20string-ci<=3D=3F/string-ci>=3D=3F?= As reported by Nils Holm (#1534) --- library.scm | 6 +++--- tests/library-tests.scm | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/library.scm b/library.scm index f7d1e91..dda97be 100644 --- a/library.scm +++ b/library.scm @@ -675,21 +675,21 @@ EOF s1 s2 'string-ci>? (lambda (len1 len2 cmp) (or (fx> cmp 0) - (and (fx< len2 len1) + (and (fx> len1 len2) (eq? cmp 0) ) ) ) ) ) ) (set! string-ci<=? (lambda (s1 s2) (compare s1 s2 'string-ci<=? (lambda (len1 len2 cmp) (if (eq? cmp 0) - (fx>= len1 len2) + (fx<= len1 len2) (fx< cmp 0) ) ) ) ) ) (set! string-ci>=? (lambda (s1 s2) (compare s1 s2 'string-ci>=? (lambda (len1 len2 cmp) (if (eq? cmp 0) - (fx<= len1 len2) + (fx>= len1 len2) (fx> cmp 0) ) ) ) ) ) ) (define (##sys#string-append x y) diff --git a/tests/library-tests.scm b/tests/library-tests.scm index b18fe7d..b75416e 100644 --- a/tests/library-tests.scm +++ b/tests/library-tests.scm @@ -479,6 +479,11 @@ A (assert (string-ci? "foo\x00b" "foo\x00A")) +;; Reported by Nils Holm (#1534) +;; See also: http://groups.google.com/group/comp.lang.scheme/t/6b8be06b84b39a7 +(assert (not (string-ci<=? "test" "tes"))) +(assert (string-ci>=? "test" "tes")) + ;;; getter-with-setter (define foo -- 1.7.9.5