From b9dbbed95c1c6bc06b3b678828798c9f2238f2ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hr=C4=8Dek?= Date: Thu, 27 Mar 2025 13:52:40 +0100 Subject: [PATCH 1/6] Ensure /usr/share/dict/words is installed in CI --- .../action-centos7/action.yaml | 2 +- .../bindist-actions/action-deb10/action.yaml | 2 +- .../bindist-actions/action-deb11/action.yaml | 2 +- .../bindist-actions/action-deb9/action.yaml | 2 +- .../action-fedora27/action.yaml | 2 +- .../action-fedora33/action.yaml | 2 +- .../action-mint193/action.yaml | 2 +- .../action-mint202/action.yaml | 2 +- .../action-ubuntu1804/action.yaml | 2 +- .../action-ubuntu2004/action.yaml | 2 +- .../action-ubuntu2204/action.yaml | 2 +- .../action-unknown/action.yaml | 2 +- .github/generate-ci/gen_ci.hs | 25 ++++++++++--------- 13 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.github/actions/bindist-actions/action-centos7/action.yaml b/.github/actions/bindist-actions/action-centos7/action.yaml index 66f97295f0..ce91ef34e8 100644 --- a/.github/actions/bindist-actions/action-centos7/action.yaml +++ b/.github/actions/bindist-actions/action-centos7/action.yaml @@ -18,6 +18,6 @@ runs: TOOLS: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which - xz zlib-devel patchelf + xz zlib-devel patchelf words image: centos:7 using: docker diff --git a/.github/actions/bindist-actions/action-deb10/action.yaml b/.github/actions/bindist-actions/action-deb10/action.yaml index da96b04669..d05a14a1d8 100644 --- a/.github/actions/bindist-actions/action-deb10/action.yaml +++ b/.github/actions/bindist-actions/action-deb10/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf + libtinfo5 patchelf wamerican image: debian:10 using: docker diff --git a/.github/actions/bindist-actions/action-deb11/action.yaml b/.github/actions/bindist-actions/action-deb11/action.yaml index 8ffe78e1db..853bdaf40a 100644 --- a/.github/actions/bindist-actions/action-deb11/action.yaml +++ b/.github/actions/bindist-actions/action-deb11/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf + libtinfo5 patchelf wamerican image: debian:11 using: docker diff --git a/.github/actions/bindist-actions/action-deb9/action.yaml b/.github/actions/bindist-actions/action-deb9/action.yaml index 693e3845a5..b9362ed546 100644 --- a/.github/actions/bindist-actions/action-deb9/action.yaml +++ b/.github/actions/bindist-actions/action-deb9/action.yaml @@ -19,6 +19,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf + libtinfo5 patchelf wamerican image: debian:9 using: docker diff --git a/.github/actions/bindist-actions/action-fedora27/action.yaml b/.github/actions/bindist-actions/action-fedora27/action.yaml index e77b944a5e..b81b06b178 100644 --- a/.github/actions/bindist-actions/action-fedora27/action.yaml +++ b/.github/actions/bindist-actions/action-fedora27/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which - xz zlib-devel patchelf + xz zlib-devel patchelf words image: fedora:27 using: docker diff --git a/.github/actions/bindist-actions/action-fedora33/action.yaml b/.github/actions/bindist-actions/action-fedora33/action.yaml index d20c8feccd..735ade600c 100644 --- a/.github/actions/bindist-actions/action-fedora33/action.yaml +++ b/.github/actions/bindist-actions/action-fedora33/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which - xz zlib-devel patchelf + xz zlib-devel patchelf words image: fedora:33 using: docker diff --git a/.github/actions/bindist-actions/action-mint193/action.yaml b/.github/actions/bindist-actions/action-mint193/action.yaml index e1269e0e56..599449e309 100644 --- a/.github/actions/bindist-actions/action-mint193/action.yaml +++ b/.github/actions/bindist-actions/action-mint193/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf + libtinfo5 patchelf wamerican image: linuxmintd/mint19.3-amd64 using: docker diff --git a/.github/actions/bindist-actions/action-mint202/action.yaml b/.github/actions/bindist-actions/action-mint202/action.yaml index adea7272f1..0a04d9ebd0 100644 --- a/.github/actions/bindist-actions/action-mint202/action.yaml +++ b/.github/actions/bindist-actions/action-mint202/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf + libtinfo5 patchelf wamerican image: linuxmintd/mint20.2-amd64 using: docker diff --git a/.github/actions/bindist-actions/action-ubuntu1804/action.yaml b/.github/actions/bindist-actions/action-ubuntu1804/action.yaml index 6a6f4662a0..0d6ba34354 100644 --- a/.github/actions/bindist-actions/action-ubuntu1804/action.yaml +++ b/.github/actions/bindist-actions/action-ubuntu1804/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf + libtinfo5 patchelf wamerican image: ubuntu:18.04 using: docker diff --git a/.github/actions/bindist-actions/action-ubuntu2004/action.yaml b/.github/actions/bindist-actions/action-ubuntu2004/action.yaml index 3a5b57a370..6f9aa9548a 100644 --- a/.github/actions/bindist-actions/action-ubuntu2004/action.yaml +++ b/.github/actions/bindist-actions/action-ubuntu2004/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf + libtinfo5 patchelf wamerican image: ubuntu:20.04 using: docker diff --git a/.github/actions/bindist-actions/action-ubuntu2204/action.yaml b/.github/actions/bindist-actions/action-ubuntu2204/action.yaml index 857776507d..f14b409683 100644 --- a/.github/actions/bindist-actions/action-ubuntu2204/action.yaml +++ b/.github/actions/bindist-actions/action-ubuntu2204/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf + libtinfo5 patchelf wamerican image: ubuntu:22.04 using: docker diff --git a/.github/actions/bindist-actions/action-unknown/action.yaml b/.github/actions/bindist-actions/action-unknown/action.yaml index 96cf0593e9..cb91c5019f 100644 --- a/.github/actions/bindist-actions/action-unknown/action.yaml +++ b/.github/actions/bindist-actions/action-unknown/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which - xz zlib-devel patchelf + xz zlib-devel patchelf words image: rockylinux:8 using: docker diff --git a/.github/generate-ci/gen_ci.hs b/.github/generate-ci/gen_ci.hs index 1cdba1ca41..48138656ca 100644 --- a/.github/generate-ci/gen_ci.hs +++ b/.github/generate-ci/gen_ci.hs @@ -129,19 +129,20 @@ distroInstall Fedora33 = "dnf install -y" distroInstall Centos7 = "sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && yum -y install epel-release && yum install -y" distroInstall Rocky8 = "yum -y install epel-release && yum install -y --allowerasing" +-- Note: 'wamerican' / 'words' package provides "/usr/share/dict/words" file used in FuzzySearch tests distroTools :: Distro -> String -distroTools Debian9 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" -distroTools Debian10 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" -distroTools Debian11 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" -distroTools Ubuntu1804 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" -distroTools Ubuntu2004 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" -distroTools Ubuntu2204 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" -distroTools Mint193 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" -distroTools Mint202 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" -distroTools Fedora27 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf" -distroTools Fedora33 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf" -distroTools Centos7 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf" -distroTools Rocky8 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf" +distroTools Debian9 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" +distroTools Debian10 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" +distroTools Debian11 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" +distroTools Ubuntu1804 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" +distroTools Ubuntu2004 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" +distroTools Ubuntu2204 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" +distroTools Mint193 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" +distroTools Mint202 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" +distroTools Fedora27 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf words" +distroTools Fedora33 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf words" +distroTools Centos7 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf words" +distroTools Rocky8 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf words" ------------------------------------------------------------------------------- -- OS/runner Config From e6697645505134b383c25bf11e96bfee098f64b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hr=C4=8Dek?= Date: Thu, 27 Mar 2025 14:19:03 +0100 Subject: [PATCH 2/6] Not in release, but in test job --- .../action-centos7/action.yaml | 2 +- .../bindist-actions/action-deb10/action.yaml | 2 +- .../bindist-actions/action-deb11/action.yaml | 2 +- .../bindist-actions/action-deb9/action.yaml | 2 +- .../action-fedora27/action.yaml | 2 +- .../action-fedora33/action.yaml | 2 +- .../action-mint193/action.yaml | 2 +- .../action-mint202/action.yaml | 2 +- .../action-ubuntu1804/action.yaml | 2 +- .../action-ubuntu2004/action.yaml | 2 +- .../action-ubuntu2204/action.yaml | 2 +- .../action-unknown/action.yaml | 2 +- .github/generate-ci/gen_ci.hs | 25 +++++++++---------- .github/workflows/test.yml | 3 +++ 14 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.github/actions/bindist-actions/action-centos7/action.yaml b/.github/actions/bindist-actions/action-centos7/action.yaml index ce91ef34e8..66f97295f0 100644 --- a/.github/actions/bindist-actions/action-centos7/action.yaml +++ b/.github/actions/bindist-actions/action-centos7/action.yaml @@ -18,6 +18,6 @@ runs: TOOLS: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which - xz zlib-devel patchelf words + xz zlib-devel patchelf image: centos:7 using: docker diff --git a/.github/actions/bindist-actions/action-deb10/action.yaml b/.github/actions/bindist-actions/action-deb10/action.yaml index d05a14a1d8..da96b04669 100644 --- a/.github/actions/bindist-actions/action-deb10/action.yaml +++ b/.github/actions/bindist-actions/action-deb10/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf wamerican + libtinfo5 patchelf image: debian:10 using: docker diff --git a/.github/actions/bindist-actions/action-deb11/action.yaml b/.github/actions/bindist-actions/action-deb11/action.yaml index 853bdaf40a..8ffe78e1db 100644 --- a/.github/actions/bindist-actions/action-deb11/action.yaml +++ b/.github/actions/bindist-actions/action-deb11/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf wamerican + libtinfo5 patchelf image: debian:11 using: docker diff --git a/.github/actions/bindist-actions/action-deb9/action.yaml b/.github/actions/bindist-actions/action-deb9/action.yaml index b9362ed546..693e3845a5 100644 --- a/.github/actions/bindist-actions/action-deb9/action.yaml +++ b/.github/actions/bindist-actions/action-deb9/action.yaml @@ -19,6 +19,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf wamerican + libtinfo5 patchelf image: debian:9 using: docker diff --git a/.github/actions/bindist-actions/action-fedora27/action.yaml b/.github/actions/bindist-actions/action-fedora27/action.yaml index b81b06b178..e77b944a5e 100644 --- a/.github/actions/bindist-actions/action-fedora27/action.yaml +++ b/.github/actions/bindist-actions/action-fedora27/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which - xz zlib-devel patchelf words + xz zlib-devel patchelf image: fedora:27 using: docker diff --git a/.github/actions/bindist-actions/action-fedora33/action.yaml b/.github/actions/bindist-actions/action-fedora33/action.yaml index 735ade600c..d20c8feccd 100644 --- a/.github/actions/bindist-actions/action-fedora33/action.yaml +++ b/.github/actions/bindist-actions/action-fedora33/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which - xz zlib-devel patchelf words + xz zlib-devel patchelf image: fedora:33 using: docker diff --git a/.github/actions/bindist-actions/action-mint193/action.yaml b/.github/actions/bindist-actions/action-mint193/action.yaml index 599449e309..e1269e0e56 100644 --- a/.github/actions/bindist-actions/action-mint193/action.yaml +++ b/.github/actions/bindist-actions/action-mint193/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf wamerican + libtinfo5 patchelf image: linuxmintd/mint19.3-amd64 using: docker diff --git a/.github/actions/bindist-actions/action-mint202/action.yaml b/.github/actions/bindist-actions/action-mint202/action.yaml index 0a04d9ebd0..adea7272f1 100644 --- a/.github/actions/bindist-actions/action-mint202/action.yaml +++ b/.github/actions/bindist-actions/action-mint202/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf wamerican + libtinfo5 patchelf image: linuxmintd/mint20.2-amd64 using: docker diff --git a/.github/actions/bindist-actions/action-ubuntu1804/action.yaml b/.github/actions/bindist-actions/action-ubuntu1804/action.yaml index 0d6ba34354..6a6f4662a0 100644 --- a/.github/actions/bindist-actions/action-ubuntu1804/action.yaml +++ b/.github/actions/bindist-actions/action-ubuntu1804/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf wamerican + libtinfo5 patchelf image: ubuntu:18.04 using: docker diff --git a/.github/actions/bindist-actions/action-ubuntu2004/action.yaml b/.github/actions/bindist-actions/action-ubuntu2004/action.yaml index 6f9aa9548a..3a5b57a370 100644 --- a/.github/actions/bindist-actions/action-ubuntu2004/action.yaml +++ b/.github/actions/bindist-actions/action-ubuntu2004/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf wamerican + libtinfo5 patchelf image: ubuntu:20.04 using: docker diff --git a/.github/actions/bindist-actions/action-ubuntu2204/action.yaml b/.github/actions/bindist-actions/action-ubuntu2204/action.yaml index f14b409683..857776507d 100644 --- a/.github/actions/bindist-actions/action-ubuntu2204/action.yaml +++ b/.github/actions/bindist-actions/action-ubuntu2204/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 - libtinfo5 patchelf wamerican + libtinfo5 patchelf image: ubuntu:22.04 using: docker diff --git a/.github/actions/bindist-actions/action-unknown/action.yaml b/.github/actions/bindist-actions/action-unknown/action.yaml index cb91c5019f..96cf0593e9 100644 --- a/.github/actions/bindist-actions/action-unknown/action.yaml +++ b/.github/actions/bindist-actions/action-unknown/action.yaml @@ -16,6 +16,6 @@ runs: TOOLS: autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which - xz zlib-devel patchelf words + xz zlib-devel patchelf image: rockylinux:8 using: docker diff --git a/.github/generate-ci/gen_ci.hs b/.github/generate-ci/gen_ci.hs index 48138656ca..1cdba1ca41 100644 --- a/.github/generate-ci/gen_ci.hs +++ b/.github/generate-ci/gen_ci.hs @@ -129,20 +129,19 @@ distroInstall Fedora33 = "dnf install -y" distroInstall Centos7 = "sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && yum -y install epel-release && yum install -y" distroInstall Rocky8 = "yum -y install epel-release && yum install -y --allowerasing" --- Note: 'wamerican' / 'words' package provides "/usr/share/dict/words" file used in FuzzySearch tests distroTools :: Distro -> String -distroTools Debian9 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" -distroTools Debian10 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" -distroTools Debian11 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" -distroTools Ubuntu1804 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" -distroTools Ubuntu2004 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" -distroTools Ubuntu2204 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" -distroTools Mint193 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" -distroTools Mint202 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf wamerican" -distroTools Fedora27 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf words" -distroTools Fedora33 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf words" -distroTools Centos7 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf words" -distroTools Rocky8 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf words" +distroTools Debian9 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" +distroTools Debian10 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" +distroTools Debian11 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" +distroTools Ubuntu1804 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" +distroTools Ubuntu2004 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" +distroTools Ubuntu2204 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" +distroTools Mint193 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" +distroTools Mint202 = "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" +distroTools Fedora27 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf" +distroTools Fedora33 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf" +distroTools Centos7 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf" +distroTools Rocky8 = "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf" ------------------------------------------------------------------------------- -- OS/runner Config diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb28c95a51..727a832046 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,6 +55,9 @@ jobs: , "test/**" , "shake-bench/**" ]' + # Ensure "/usr/share/dict/words" used by FuzzySearch tests is installed + - id: install_words + run: apt-get update && apt-get install -y wamerican test: if: needs.pre_job.outputs.should_skip != 'true' From 079eebcdd29b8b34986c06ab65db7cf7e2a442e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hr=C4=8Dek?= Date: Thu, 27 Mar 2025 14:26:26 +0100 Subject: [PATCH 3/6] Add sudo --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 727a832046..4e2ad29228 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,7 +57,7 @@ jobs: ]' # Ensure "/usr/share/dict/words" used by FuzzySearch tests is installed - id: install_words - run: apt-get update && apt-get install -y wamerican + run: sudo apt-get update && sudo apt-get install -y wamerican test: if: needs.pre_job.outputs.should_skip != 'true' From e9fda534ac8b8216999e777013be4ccea4ed74c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hr=C4=8Dek?= Date: Thu, 27 Mar 2025 14:46:15 +0100 Subject: [PATCH 4/6] Do it in setup-build action instead of pre_job --- .github/actions/setup-build/action.yml | 6 ++++++ .github/workflows/test.yml | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml index 9237cadfbe..6674e84e27 100644 --- a/.github/actions/setup-build/action.yml +++ b/.github/actions/setup-build/action.yml @@ -131,3 +131,9 @@ runs: if: runner.os == 'Linux' run: ghcup gc --ghc-old --share-dir --hls-no-ghc --cache --tmpdirs --unset shell: bash + + # wamerican package provides "/usr/share/dict/words" needed by FuzzySearch tests + - name: "Install wamerican package" + if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install -y wamerican + shell: bash diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e2ad29228..eb28c95a51 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,9 +55,6 @@ jobs: , "test/**" , "shake-bench/**" ]' - # Ensure "/usr/share/dict/words" used by FuzzySearch tests is installed - - id: install_words - run: sudo apt-get update && sudo apt-get install -y wamerican test: if: needs.pre_job.outputs.should_skip != 'true' From ebee93c0abdc427d76b0c5c8c08ef2f5d2961796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hr=C4=8Dek?= Date: Thu, 27 Mar 2025 15:28:14 +0100 Subject: [PATCH 5/6] Use quickcheck === to get more informative errors --- ghcide-test/exe/FuzzySearch.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ghcide-test/exe/FuzzySearch.hs b/ghcide-test/exe/FuzzySearch.hs index f09bb7f863..62efb9149f 100644 --- a/ghcide-test/exe/FuzzySearch.hs +++ b/ghcide-test/exe/FuzzySearch.hs @@ -29,7 +29,7 @@ tests = ] ] -test :: Text -> Bool +test :: Text -> Property test candidate = do let previous = catMaybes @@ -38,7 +38,7 @@ test candidate = do | d <- dictionary ] new = catMaybes [(d,) <$> match candidate d | d <- dictionary] - previous == new + previous === new propLegit :: Property propLegit = forAll (elements dictionary) test @@ -91,7 +91,7 @@ referenceImplementation :: forall s t. referenceImplementation pat' t pre post extract = if null pat then Just (Fuzzy t result totalScore) else Nothing where - null :: (T.TextualMonoid s) => s -> Bool + null :: s -> Bool null = not . T.any (const True) s = extract t From cb52c795149d9955fe515fa46cca452571445966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hr=C4=8Dek?= Date: Mon, 31 Mar 2025 15:44:16 +0200 Subject: [PATCH 6/6] Replace fuzzy search test with few simpler unit tests --- .github/actions/setup-build/action.yml | 6 - ghcide-test/exe/FuzzySearch.hs | 158 +++++++------------------ ghcide-test/exe/UnitTests.hs | 2 - haskell-language-server.cabal | 2 - 4 files changed, 40 insertions(+), 128 deletions(-) diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml index 6674e84e27..9237cadfbe 100644 --- a/.github/actions/setup-build/action.yml +++ b/.github/actions/setup-build/action.yml @@ -131,9 +131,3 @@ runs: if: runner.os == 'Linux' run: ghcup gc --ghc-old --share-dir --hls-no-ghc --cache --tmpdirs --unset shell: bash - - # wamerican package provides "/usr/share/dict/words" needed by FuzzySearch tests - - name: "Install wamerican package" - if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y wamerican - shell: bash diff --git a/ghcide-test/exe/FuzzySearch.hs b/ghcide-test/exe/FuzzySearch.hs index 62efb9149f..1d2a5ac181 100644 --- a/ghcide-test/exe/FuzzySearch.hs +++ b/ghcide-test/exe/FuzzySearch.hs @@ -1,130 +1,52 @@ module FuzzySearch (tests) where -import Data.Char (toLower) -import Data.Maybe (catMaybes) -import qualified Data.Monoid.Textual as T -import Data.Text (Text, inits, pack) -import qualified Data.Text as Text -import Prelude hiding (filter) -import System.Directory (doesFileExist) -import System.IO.Unsafe (unsafePerformIO) -import Test.QuickCheck +import Data.Maybe (isJust, mapMaybe) +import Data.Text (Text) +import qualified Data.Text as Text +import Prelude hiding (filter) import Test.Tasty -import Test.Tasty.ExpectedFailure -import Test.Tasty.QuickCheck (testProperty) -import qualified Text.Fuzzy as Fuzzy -import Text.Fuzzy (Fuzzy (..)) +import Test.Tasty.HUnit +import Test.Tasty.QuickCheck import Text.Fuzzy.Parallel tests :: TestTree tests = testGroup "Fuzzy search" - [ needDictionary $ - testGroup - "match works as expected on the english dictionary" - [ testProperty "for legit words" propLegit, - testProperty "for prefixes" propPrefix, - testProperty "for typos" propTypo - ] + [ testGroup "match" + [ testCase "empty" $ + match "" "" @?= Just 0 + , testCase "camel case" $ + match "myImportantField" "myImportantField" @?= Just 262124 + , testCase "a" $ + mapMaybe (matchInput "a") ["", "a", "aa", "aaa", "A", "AA", "aA", "Aa"] + @?= [("a",3),("aa",3),("aaa",3),("aA",3),("Aa",1)] + , testCase "lowercase words" $ + mapMaybe (matchInput "abc") ["abc", "abcd", "axbc", "axbxc", "def"] + @?= [("abc", 25), ("abcd", 25), ("axbc", 7), ("axbxc", 5)] + , testCase "lower upper mix" $ + mapMaybe (matchInput "abc") ["abc", "aBc", "axbC", "axBxC", "def"] + @?= [("abc", 25), ("aBc", 25), ("axbC", 7), ("axBxC", 5)] + , testCase "prefixes" $ + mapMaybe (matchInput "alpha") (Text.inits "alphabet") + @?= [("alpha", 119), ("alphab", 119), ("alphabe", 119), ("alphabet", 119)] + , testProperty "x `isSubsequenceOf` y => match x y returns Just" + prop_matchIfSubsequence + ] ] - -test :: Text -> Property -test candidate = do - let previous = - catMaybes - [ (d,) . Fuzzy.score - <$> referenceImplementation candidate d "" "" id - | d <- dictionary - ] - new = catMaybes [(d,) <$> match candidate d | d <- dictionary] - previous === new - -propLegit :: Property -propLegit = forAll (elements dictionary) test - -propPrefix :: Property -propPrefix = forAll (elements dictionary >>= elements . inits) test - -propTypo :: Property -propTypo = forAll typoGen test - -typoGen :: Gen Text -typoGen = do - w <- elements dictionary - l <- elements [0 .. Text.length w -1] - let wl = Text.index w l - c <- elements [ c | c <- ['a' .. 'z'], c /= wl] - return $ replaceAt w l c - -replaceAt :: Text -> Int -> Char -> Text -replaceAt t i c = - let (l, r) = Text.splitAt i t - in l <> Text.singleton c <> r - -dictionaryPath :: FilePath -dictionaryPath = "/usr/share/dict/words" - -{-# ANN dictionary ("HLint: ignore Avoid restricted function" :: String) #-} -{-# NOINLINE dictionary #-} -dictionary :: [Text] -dictionary = unsafePerformIO $ do - existsDictionary <- doesFileExist dictionaryPath - if existsDictionary - then map pack . words <$> readFile dictionaryPath - else pure [] - -referenceImplementation :: forall s t. - (T.TextualMonoid s) => - -- | Pattern in lowercase except for first character - s -> - -- | The value containing the text to search in. - t -> - -- | The text to add before each match. - s -> - -- | The text to add after each match. - s -> - -- | The function to extract the text from the container. - (t -> s) -> - -- | The original value, rendered string and score. - Maybe (Fuzzy t s) -referenceImplementation pat' t pre post extract = - if null pat then Just (Fuzzy t result totalScore) else Nothing where - null :: s -> Bool - null = not . T.any (const True) - - s = extract t - (totalScore, _currScore, result, pat, _) = - T.foldl' - undefined - ( \(tot, cur, res, pat, isFirst) c -> - case T.splitCharacterPrefix pat of - Nothing -> (tot, 0, res <> T.singleton c, pat, isFirst) - Just (x, xs) -> - -- the case of the first character has to match - -- otherwise use lower case since the pattern is assumed lower - let !c' = if isFirst then c else toLower c - in if x == c' - then - let cur' = cur * 2 + 1 - in ( tot + cur', - cur', - res <> pre <> T.singleton c <> post, - xs, - False - ) - else (tot, 0, res <> T.singleton c, pat, isFirst) - ) - ( 0, - 1, -- matching at the start gives a bonus (cur = 1) - mempty, - pat', - True - ) - s + matchInput :: Text -> Text -> Maybe (Text, Int) + matchInput needle candidate = (candidate,) <$> match needle candidate + +prop_matchIfSubsequence :: Property +prop_matchIfSubsequence = + forAll genNonEmptyText $ \haystack -> + forAll (genSubsequence haystack) $ \needle -> + isJust (match needle haystack) + where + genNonEmptyText = + Text.pack <$> listOf1 (elements $ ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9']) -needDictionary :: TestTree -> TestTree -needDictionary - | null dictionary = ignoreTestBecause ("not found: " <> dictionaryPath) - | otherwise = id + genSubsequence :: Text -> Gen Text + genSubsequence = + fmap Text.pack . sublistOf . Text.unpack diff --git a/ghcide-test/exe/UnitTests.hs b/ghcide-test/exe/UnitTests.hs index d405955197..b2940ab27f 100644 --- a/ghcide-test/exe/UnitTests.hs +++ b/ghcide-test/exe/UnitTests.hs @@ -29,8 +29,6 @@ import qualified Progress import System.IO.Extra hiding (withTempDir) import System.Mem (performGC) import Test.Hls (IdeState, def, - ignoreForGhcVersions, - GhcVersion(..), runSessionWithServerInTmpDir, waitForProgressDone) import Test.Tasty diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index 95b3c07f12..0990d3502c 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -2094,7 +2094,6 @@ test-suite ghcide-tests , enummapset , extra , filepath - , fuzzy , ghcide , hls-plugin-api , lens @@ -2102,7 +2101,6 @@ test-suite ghcide-tests , lsp , lsp-test ^>=0.17.1 , lsp-types - , monoid-subclasses , mtl , network-uri , QuickCheck