diff options
author | Danny Milosavljevic <dannym@scratchpost.org> | 2021-02-11 19:12:36 +0100 |
---|---|---|
committer | Danny Milosavljevic <dannym@scratchpost.org> | 2021-02-11 19:12:36 +0100 |
commit | abd318ff4b741eac11227778bf2e569ee7b186ff (patch) | |
tree | 6abc09a3e01914d891124e9d0dda0f4e0979c485 /tests | |
parent | 71cb6dfe10540718eb337e7e2248fc809394894b (diff) | |
parent | c5dc87fee840ad620b01637dc4f9ffa5efc9270c (diff) | |
download | guix-abd318ff4b741eac11227778bf2e569ee7b186ff.tar.gz |
Merge branch 'master' into core-updates
Diffstat (limited to 'tests')
-rw-r--r-- | tests/utils.scm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/utils.scm b/tests/utils.scm index 62ec7e8b4c..7fcbb25552 100644 --- a/tests/utils.scm +++ b/tests/utils.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org> ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org> +;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -271,6 +272,23 @@ skip these tests." string-reverse) (call-with-input-file temp-file get-string-all))) +(test-equal "string-distance" + '(0 1 1 5 5) + (list + (string-distance "hello" "hello") + (string-distance "hello" "helo") + (string-distance "helo" "hello") + (string-distance "" "hello") + (string-distance "hello" ""))) + +(test-equal "string-closest" + '("hello" "hello" "helo" #f) + (list + (string-closest "hello" '("hello")) + (string-closest "hello" '("helo" "hello" "halo")) + (string-closest "hello" '("kikoo" "helo" "hihihi" "halo")) + (string-closest "hello" '("aaaaa" "12345" "hellohello" "h")))) + (test-end) (false-if-exception (delete-file temp-file)) |