aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/sandbox/case
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-03-27 23:43:13 +0900
committerOphestra <cat@gensokyo.uk>2025-03-27 23:43:13 +0900
commitd97a03c7c6d723587b6c35c8cbd8b69101d7e93f (patch)
treefe0a544a598d59461299c490f800b5d9f86b5901 /test/sandbox/case
parenta102178019cc290b2593f54cc6b12e1ae8258d1e (diff)
test/sandbox: separate test tool source
This improves readability and allows gofmt to format the file. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'test/sandbox/case')
-rw-r--r--test/sandbox/case/default.nix34
-rw-r--r--test/sandbox/case/main.go9
2 files changed, 34 insertions, 9 deletions
diff --git a/test/sandbox/case/default.nix b/test/sandbox/case/default.nix
index d00eabf9..c4bfb401 100644
--- a/test/sandbox/case/default.nix
+++ b/test/sandbox/case/default.nix
@@ -1,12 +1,14 @@
-{
- lib,
- callPackage,
- writeText,
- foot,
-
- version,
-}:
+pkgs: version:
let
+ inherit (pkgs)
+ lib
+ writeText
+ buildGoModule
+ pkg-config
+ util-linux
+ foot
+ ;
+
fs = mode: dir: data: {
mode = lib.fromHexString mode;
inherit
@@ -30,7 +32,21 @@ let
;
};
- checkSandbox = callPackage ../assert.nix { inherit version; };
+ checkSandbox = buildGoModule {
+ pname = "check-sandbox";
+ inherit version;
+
+ src = ../../.;
+ vendorHash = null;
+
+ buildInputs = [ util-linux ];
+ nativeBuildInputs = [ pkg-config ];
+
+ preBuild = ''
+ go mod init git.gensokyo.uk/security/fortify/test >& /dev/null
+ cp ${./main.go} main.go
+ '';
+ };
callTestCase =
path:
diff --git a/test/sandbox/case/main.go b/test/sandbox/case/main.go
new file mode 100644
index 00000000..59c80efb
--- /dev/null
+++ b/test/sandbox/case/main.go
@@ -0,0 +1,9 @@
+package main
+
+import (
+ "os"
+
+ "git.gensokyo.uk/security/fortify/test/sandbox"
+)
+
+func main() { (&sandbox.T{FS: os.DirFS("/")}).MustCheckFile(os.Args[1], "/tmp/sandbox-ok") }