nix-config/tests/neovim.nix

45 lines
939 B
Nix
Raw Normal View History

{ self, pkgs }:
self.inputs.nixpkgs.lib.nixos.runTest {
name = "neovim";
hostPkgs = pkgs;
node.specialArgs.nix-config = self;
nodes.machine =
2024-10-16 05:01:19 +02:00
{ nix-config, config, ... }:
{
2024-09-01 19:43:24 +02:00
imports = with nix-config.nixosModules; [
shell
system
stylix
2024-09-01 19:43:24 +02:00
];
2024-09-01 20:11:59 +02:00
home-manager.sharedModules = with nix-config.homeModules; [
neovim
];
2024-10-16 05:01:19 +02:00
services.getty.autologinUser = config.modules.system.username;
};
testScript = # python
''
machine.wait_for_unit("default.target")
machine.send_chars("nvim hello.txt\n")
machine.sleep(30)
machine.send_chars("i")
machine.sleep(2)
machine.send_chars("Hello world")
machine.sleep(2)
machine.send_key("esc")
machine.sleep(2)
machine.send_chars(":wq\n")
machine.sleep(2)
text = machine.succeed("cat /home/user/hello.txt")
assert "Hello world" in text
'';
}