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 + ]; + }; +}