tangled
alpha
login
or
join now
tjh.dev
/
nixpkgs
Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
0
fork
atom
overview
issues
pulls
pipelines
zsh-history: Add tests
Christian Kampka
6 years ago
c98d54a3
b85286fe
+41
-1
3 changed files
expand all
collapse all
unified
split
nixos
tests
all-tests.nix
zsh-history.nix
pkgs
shells
zsh
zsh-history
default.nix
+1
nixos/tests/all-tests.nix
···
294
294
xss-lock = handleTest ./xss-lock.nix {};
295
295
yabar = handleTest ./yabar.nix {};
296
296
yggdrasil = handleTest ./yggdrasil.nix {};
297
297
+
zsh-history = handleTest ./zsh-history.nix {};
297
298
zookeeper = handleTest ./zookeeper.nix {};
298
299
}
+35
nixos/tests/zsh-history.nix
···
1
1
+
import ./make-test-python.nix ({ pkgs, ...} : {
2
2
+
name = "zsh-history";
3
3
+
meta = with pkgs.stdenv.lib.maintainers; {
4
4
+
maintainers = [ kampka ];
5
5
+
};
6
6
+
7
7
+
nodes.default = { ... }: {
8
8
+
programs = {
9
9
+
zsh.enable = true;
10
10
+
};
11
11
+
environment.systemPackages = [ pkgs.zsh-history ];
12
12
+
programs.zsh.interactiveShellInit = ''
13
13
+
source ${pkgs.zsh-history.out}/share/zsh/init.zsh
14
14
+
'';
15
15
+
users.users.root.shell = "${pkgs.zsh}/bin/zsh";
16
16
+
};
17
17
+
18
18
+
testScript = ''
19
19
+
start_all()
20
20
+
default.wait_for_unit("multi-user.target")
21
21
+
default.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
22
22
+
23
23
+
# Login
24
24
+
default.wait_until_tty_matches(1, "login: ")
25
25
+
default.send_chars("root\n")
26
26
+
default.wait_until_tty_matches(1, "root@default>")
27
27
+
28
28
+
# Generate some history
29
29
+
default.send_chars("echo foobar\n")
30
30
+
default.wait_until_tty_matches(1, "foobar")
31
31
+
32
32
+
# Ensure that command was recorded in history
33
33
+
default.succeed("/run/current-system/sw/bin/history list | grep -q foobar")
34
34
+
'';
35
35
+
})
+5
-1
pkgs/shells/zsh/zsh-history/default.nix
···
1
1
-
{ lib, fetchFromGitHub, buildGoModule, installShellFiles }:
1
1
+
{ lib, fetchFromGitHub, buildGoModule, installShellFiles, nixosTests }:
2
2
3
3
buildGoModule rec {
4
4
pname = "zsh-history";
···
28
28
homepage = https://github.com/b4b4r07/history;
29
29
platforms = platforms.unix;
30
30
maintainers = with maintainers; [ kampka ];
31
31
+
};
32
32
+
33
33
+
passthru.tests = {
34
34
+
zsh-history-shell-integration = nixosTests.zsh-history;
31
35
};
32
36
}