diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-03-23 14:14:45 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-03-23 14:53:50 +0900 |
| commit | 75e0c5d4061d68dc4802285ec137e464f4e01b17 (patch) | |
| tree | b8307fa68188bac4c522afc36c27a5c1fb7c02da /test/sandbox/assert.nix | |
| parent | 770b37ae166a18f495865e96ccafc6f9fb9f4e88 (diff) | |
test/sandbox: parse full test case
This makes declaring multiple tests much cleaner.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'test/sandbox/assert.nix')
| -rw-r--r-- | test/sandbox/assert.nix | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/sandbox/assert.nix b/test/sandbox/assert.nix new file mode 100644 index 00000000..d45e4cb9 --- /dev/null +++ b/test/sandbox/assert.nix @@ -0,0 +1,31 @@ +{ + writeText, + buildGoModule, + + version, + name, + want, +}: +let + wantFile = writeText "fortify-${name}-want.json" (builtins.toJSON want); + mainFile = writeText "main.go" '' + package main + + import "os" + import "git.gensokyo.uk/security/fortify/test/sandbox" + + func main() { (&sandbox.T{FS: os.DirFS("/"), PMountsPath: "/.fortify/mounts"}).MustCheckFile("${wantFile}") } + ''; +in +buildGoModule { + pname = "fortify-${name}-check-sandbox"; + inherit version; + + src = ../.; + vendorHash = null; + + preBuild = '' + go mod init git.gensokyo.uk/security/fortify/test >& /dev/null + cp ${mainFile} main.go + ''; +} |
