Jelajahi Sumber

test(flake/cargo): add nix feature

This adds the nix feature to specify tests only to be run in the sandbox.

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
Christina Sørensen 2 tahun lalu
induk
melakukan
b2c424f4ca
3 mengubah file dengan 11 tambahan dan 0 penghapusan
  1. 2 0
      Cargo.toml
  2. 2 0
      flake.nix
  3. 7 0
      tests/cli_tests.rs

+ 2 - 0
Cargo.toml

@@ -78,6 +78,8 @@ default = [ "git" ]
 git = [ "git2" ]
 vendored-openssl = ["git2/vendored-openssl"]
 vendored-libgit2 = ["git2/vendored-libgit2"]
+# Should only be used inside of flake.nix
+nix = []
 
 
 # make dev builds faster by excluding debug symbols

+ 2 - 0
flake.nix

@@ -114,6 +114,7 @@
             src = ./.;
             mode = "test";
             # cargoTestOptions = opts: opts ++ [ "--test cli_tests" ];
+            cargoTestOptions = opts: opts ++ [ "--features nix" ];
             inherit buildInputs;
           };
 
@@ -122,6 +123,7 @@
             src = ./.;
             mode = "test";
             # cargoTestOptions = opts: opts ++ [ "--test cli_tests" ];
+            cargoTestOptions = opts: opts ++ [ "--features nix" ];
             TRYCMD="dump";
             postInstall = ''
               cp dump $out -r

+ 7 - 0
tests/cli_tests.rs

@@ -17,3 +17,10 @@ fn cli_windows_tests() {
     trycmd::TestCases::new()
         .case("tests/cmd/*_windows.toml");
 }
+
+#[test]
+#[cfg(feature="nix")]
+fn cli_nix_tests() {
+    trycmd::TestCases::new()
+        .case("tests/cmd/*_nix.toml");
+}