From 5b29d4a1fa3df935c5e68bb2913b7d831ef77932 Mon Sep 17 00:00:00 2001 From: felix Date: Sat, 15 Sep 2018 11:26:32 +0200 Subject: [PATCH] =?UTF-8?q?fix=20string-ci>=3D=3F/string-ci<=3D=3F=20with?= =?UTF-8?q?=20arguments=20that=20have=20matching=20prefix=20but=20differen?= =?UTF-8?q?t=20length?= Reported by Nils Holm. See also: https://groups.google.com/forum/?_escaped_fragment_=topic/comp.lang.scheme/Bri-BrhLOac#!topic/comp.lang.scheme/Bri-BrhLOac --- library.scm | 4 ++-- tests/library-tests.scm | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/library.scm b/library.scm index e81648cd..72d32150 100644 --- a/library.scm +++ b/library.scm @@ -1470,14 +1470,14 @@ EOF s1 s2 'string-ci<=? (lambda (len1 len2 cmp) (if (eq? cmp 0) - (fx>= len1 len2) + (fx<= len1 len2) (fx< cmp 0) ) ) ) ) ) (set! scheme#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 bf1164e1..50557854 100644 --- a/tests/library-tests.scm +++ b/tests/library-tests.scm @@ -498,6 +498,13 @@ A (assert (string-ci? "foo\x00b" "foo\x00A")) +;; reported by Nils Holm +;; https://groups.google.com/forum/?_escaped_fragment_=topic/comp.lang.scheme/Bri-BrhLOac#!topic/comp.lang.scheme/Bri-BrhLOac + +(assert (not (string-ci<=? "test" "tes"))) +(assert (string-ci>=? "test" "tes")) + + ;;; getter-with-setter (define foo -- 2.16.2