Unverified Commit 67e2832f authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

luaPackages.fzf-lua: add tests (#382459)

parents 9caba2b8 7f931c6d
Loading
Loading
Loading
Loading
+48 −9
Original line number Diff line number Diff line
@@ -7,16 +7,16 @@
  # plenary utilities
  which,
  findutils,
  clang,
  coreutils,
  curl,
  cyrus_sasl,
  dbus,
  expat,
  fd,
  fetchFromGitHub,
  fetchpatch,
  fetchurl,
  fixDarwinDylibNames,
  fzf,
  glib,
  glibc,
  gmp,
@@ -36,10 +36,9 @@
  libuv,
  libxcrypt,
  libyaml,
  luajitPackages,
  lua-language-server,
  luajitPackages,
  mariadb,
  magic-enum,
  mpfr,
  neovim-unwrapped,
  openldap,
@@ -47,19 +46,18 @@
  pcre,
  pkg-config,
  readline,
  ripgrep,
  rustPlatform,
  sol2,
  sqlite,
  tomlplusplus,
  tree-sitter,
  unbound,
  unzip,
  vimPlugins,
  vimUtils,
  yajl,
  zip,
  unzip,
  zlib,
  zziplib,
  writableTmpDirAsHomeHook,
}:

final: prev:
@@ -69,7 +67,6 @@ let
    luaAtLeast
    lua
    isLuaJIT
    isLua51
    ;
in
{
@@ -160,6 +157,48 @@ in
      '';
  });

  fzf-lua = prev.fzf-lua.overrideAttrs {
    # FIXME: Darwin flaky tests
    # address already in use on second test run
    # Previewer transient failure
    doCheck = !stdenv.hostPlatform.isDarwin;
    checkInputs = [
      fd
      fzf
      ripgrep
    ];
    nativeCheckInputs = [
      neovim-unwrapped
      writableTmpDirAsHomeHook
    ];
    checkPhase = ''
      runHook preCheck

      # Linking the dependencies since makefile wants to clone them each time
      # for `make deps`
      mkdir -p deps
      ln -s ${vimPlugins.mini-nvim} deps/mini.nvim
      ln -s ${vimPlugins.nvim-web-devicons} deps/nvim-web-devicons

      # TODO: remove with new nvim-web-devicons release
      # Disabled devicons test because we have old version as dep and fzf-lua checks for a new icon
      substituteInPlace tests/file/ui_spec.lua \
        --replace-fail \
          "T[\"files()\"][\"icons\"] = new_set({ parametrize = { { \"devicons\" }, { \"mini\" } } })" \
          "T[\"files()\"][\"icons\"] = new_set({ parametrize = { { \"mini\" } } })"

      # TODO: Figure out why 2 files extra for `fd`
      substituteInPlace tests/file/ui_spec.lua \
        --replace-fail \
          "T[\"files()\"][\"executable\"] = new_set({ parametrize = { { \"fd\" }, { \"rg\" }, { \"find|dir\" } } }, {" \
          "T[\"files()\"][\"executable\"] = new_set({ parametrize = { { \"rg\" }, { \"find|dir\" } } }, {"

      make test

      runHook postCheck
    '';
  };

  # Until https://github.com/swarn/fzy-lua/pull/8 is merged,
  # we have to invoke busted manually
  fzy = prev.fzy.overrideAttrs (oa: {