mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
flake/tests: initial test script
This commit is contained in:
parent
198a36f3d4
commit
c3c76afda4
3 changed files with 38 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,6 +2,7 @@
|
||||||
result
|
result
|
||||||
result/
|
result/
|
||||||
.direnv
|
.direnv
|
||||||
|
.nixos-test-history
|
||||||
|
|
||||||
# Ignore files generated by common IDEs
|
# Ignore files generated by common IDEs
|
||||||
.vscode/*
|
.vscode/*
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
}:
|
}:
|
||||||
nixosTest {
|
nixosTest {
|
||||||
name = "home-manager-test";
|
name = "home-manager-test";
|
||||||
|
skipLint = true;
|
||||||
|
|
||||||
nodes.machine = {
|
nodes.machine = {
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -27,5 +28,39 @@ nixosTest {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = "";
|
testScript = ''
|
||||||
|
import subprocess
|
||||||
|
machine.wait_for_unit("default.target")
|
||||||
|
|
||||||
|
def check_errs(process):
|
||||||
|
# Check for errors
|
||||||
|
print("Connecting to Neovim process")
|
||||||
|
|
||||||
|
# Capture stdout and stderr
|
||||||
|
stdout, stderr = process.communicate()
|
||||||
|
|
||||||
|
# Print captured stdout and stderr
|
||||||
|
if stdout:
|
||||||
|
print("Captured stdout:")
|
||||||
|
print(stdout.decode('utf-8'))
|
||||||
|
if stderr:
|
||||||
|
print("Captured stderr:")
|
||||||
|
print(stderr.decode('utf-8'))
|
||||||
|
|
||||||
|
def run_neovim_headless():
|
||||||
|
print("Running Neovim in headless mode.")
|
||||||
|
|
||||||
|
# Run Neovim in headless mode
|
||||||
|
nvim_process = subprocess.Popen(['nvim', '--headless'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
|
||||||
|
check_errs(nvim_process)
|
||||||
|
|
||||||
|
# Load configuration file
|
||||||
|
nvim_process.stdin.write(b':NonExistentCommand\n')
|
||||||
|
nvim_process.stdin.flush()
|
||||||
|
|
||||||
|
# run Neovim in headless mode
|
||||||
|
# and expect it to return sucessfully
|
||||||
|
machine.succeed(run_neovim_headless())
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
in {
|
in {
|
||||||
checks = packagesFromDirectoryRecursive {
|
checks = packagesFromDirectoryRecursive {
|
||||||
inherit callPackage;
|
inherit callPackage;
|
||||||
|
testProfile = ../profiles/minimal.nix;
|
||||||
directory = ./checks;
|
directory = ./checks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue