tests: cover flake refs and lexer/parser regressions
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I1b5f90bbb210262a9287a9b8eac02e9d6a6a6964
This commit is contained in:
parent
b319ef6f3f
commit
531855d91a
4 changed files with 171 additions and 2 deletions
19
tests/integration/flake_ref/flake.nix
Normal file
19
tests/integration/flake_ref/flake.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
description = "Local flake fixture for nixir integration tests";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
|
||||
outputs = { self, nixpkgs }: {
|
||||
value = 42;
|
||||
nixosConfigurations.demo = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
({ ... }: {
|
||||
networking.hostName = "nixir-demo";
|
||||
system.stateVersion = "24.11";
|
||||
services.openssh.enable = true;
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -72,4 +72,32 @@ else
|
|||
fi
|
||||
echo ""
|
||||
|
||||
echo "Test 6: Flake Reference Compilation"
|
||||
echo "-----------------------------------"
|
||||
flake_ir=$(mktemp /tmp/nixir-flake-value-XXXXXX.nixir)
|
||||
"$(pwd)/build/nix-irc" "$TEST_DIR/flake_ref#value" "$flake_ir"
|
||||
result=$(nix-instantiate --plugin-files "$PLUGIN_PATH" --eval --strict --json --expr "builtins.nixIR_loadIR \"$flake_ir\"" 2>&1)
|
||||
if echo "$result" | grep -q '^42$'; then
|
||||
echo "[PASS] Flake reference compiles and evaluates correctly"
|
||||
else
|
||||
echo "[FAIL] Flake reference compilation broken"
|
||||
echo "$result"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "Test 7: NixOS Configuration Attribute Path"
|
||||
echo "------------------------------------------"
|
||||
config_ir=$(mktemp /tmp/nixir-flake-config-XXXXXX.nixir)
|
||||
"$(pwd)/build/nix-irc" "$TEST_DIR/flake_ref#nixosConfigurations.demo.config.networking.hostName" "$config_ir"
|
||||
result=$(nix-instantiate --plugin-files "$PLUGIN_PATH" --eval --strict --json --expr "builtins.nixIR_loadIR \"$config_ir\"" 2>&1)
|
||||
if echo "$result" | grep -q '"nixir-demo"'; then
|
||||
echo "[PASS] Nested flake attribute selection works for nixosConfigurations"
|
||||
else
|
||||
echo "[FAIL] NixOS configuration flake selection broken"
|
||||
echo "$result"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "Integration Tests Complete"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue