From e58c9f4b3233d63abe4dfc4f7d69704900428348 Mon Sep 17 00:00:00 2001 From: nzbr Date: Wed, 18 Mar 2026 23:08:10 +0100 Subject: [PATCH] add test for envfs --- tests/envfs/envfs.Tests.ps1 | 37 +++++++++++++++++++++++++++++++++++++ tests/envfs/envfs.nix | 15 +++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 tests/envfs/envfs.Tests.ps1 create mode 100644 tests/envfs/envfs.nix diff --git a/tests/envfs/envfs.Tests.ps1 b/tests/envfs/envfs.Tests.ps1 new file mode 100644 index 0000000..a75ca65 --- /dev/null +++ b/tests/envfs/envfs.Tests.ps1 @@ -0,0 +1,37 @@ +BeforeAll { + . $PSScriptRoot/../lib/lib.ps1 +} + +Describe "envfs" { + BeforeAll { + $distro = [Distro]::new() + } + + It "should install" { + $distro.InstallConfig("$PSScriptRoot/envfs.nix", "switch") + } + + It "should not break the distro" { + $distro.Launch("true") + $LASTEXITCODE | Should -Be 0 + } + + It "should allow running scripts with #!/bin/python3 instead of #!/usr/bin/env python3" { + $distro.Launch("echo '#!/bin/python3' > ~/test.py") + $LASTEXITCODE | Should -Be 0 + + $distro.Launch("echo print(`"hello`") >> ~/test.py") + $LASTEXITCODE | Should -Be 0 + + $distro.Launch("chmod +x ~/test.py") + $LASTEXITCODE | Should -Be 0 + + $output = $distro.Launch("~/test.py") | Select-Object -Last 1 + $output | Should -BeExactly "hello" + $LASTEXITCODE | Should -Be 0 + } + + AfterAll { + $distro.Uninstall() + } +} diff --git a/tests/envfs/envfs.nix b/tests/envfs/envfs.nix new file mode 100644 index 0000000..831de78 --- /dev/null +++ b/tests/envfs/envfs.nix @@ -0,0 +1,15 @@ +{ lib, pkgs, ... }: +with lib; { + imports = [ + + ]; + + config = { + wsl.enable = true; + services.envfs.enable = true; + + environment.systemPackages = [ + pkgs.python3 + ]; + }; +}