nixos/starship: add a test

main
Daniel Thwaites 2 years ago
parent 3f1ef8fe14
commit f366ae6429
No known key found for this signature in database
GPG Key ID: D8AFC4BF05670F9D
  1. 1
      nixos/tests/all-tests.nix
  2. 31
      nixos/tests/starship.nix
  3. 5
      pkgs/tools/misc/starship/default.nix

@ -445,6 +445,7 @@ in
sslh = handleTest ./sslh.nix {};
sssd = handleTestOn ["x86_64-linux"] ./sssd.nix {};
sssd-ldap = handleTestOn ["x86_64-linux"] ./sssd-ldap.nix {};
starship = handleTest ./starship.nix {};
step-ca = handleTestOn ["x86_64-linux"] ./step-ca.nix {};
strongswan-swanctl = handleTest ./strongswan-swanctl.nix {};
sudo = handleTest ./sudo.nix {};

@ -0,0 +1,31 @@
import ./make-test-python.nix ({ pkgs, ... }: {
name = "starship";
meta.maintainers = pkgs.starship.meta.maintainers;
machine = {
programs = {
fish.enable = true;
zsh.enable = true;
starship = {
enable = true;
settings.format = "<starship>";
};
};
services.getty.autologinUser = "root";
};
testScript = ''
start_all()
machine.wait_for_unit("default.target")
for shell in ["bash", "fish", "zsh"]:
machine.send_chars(f"script -c {shell} /tmp/{shell}.txt\n")
machine.wait_until_tty_matches(1, f"Script started.*{shell}.txt")
machine.send_chars("exit\n")
machine.wait_until_tty_matches(1, "Script done")
machine.sleep(1)
machine.succeed(f"grep -q '<starship>' /tmp/{shell}.txt")
'';
})

@ -6,6 +6,7 @@
, openssl
, installShellFiles
, libiconv
, nixosTests
, Security
}:
@ -40,6 +41,10 @@ rustPlatform.buildRustPackage rec {
HOME=$TMPDIR
'';
passthru.tests = {
inherit (nixosTests) starship;
};
meta = with lib; {
description = "A minimal, blazing fast, and extremely customizable prompt for any shell";
homepage = "https://starship.rs";

Loading…
Cancel
Save