aboutsummaryrefslogtreecommitdiffstats
path: root/tests/query/injections/nix/test-nix-injections.nix
blob: 477ca4abbeeb8870ec45ed24b5a1e645dfc7e5e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{ pkgs, stdenv }:
# NOTE: This file is for testing queries. If evaluated with nix, this will probably error.
{ 
  regex = builtins.match "^.*[{](.+)[}].*$" "blahblah {something} blahblah" [ "something" ];

  drv1 = stdenv.mkDerivation {
    buildPhase = "mkdir $out";
    installPhase = ''
      echo "bar" > $out/foo.txt
    '';
  };
  
  drv2 = pkgs.writeShellApplication {
    name = "shellApp";
    buildInputs = [];
    text = ''
      echo "Hello world!"
    '';
  };

  drv3 = pkgs.runCommand "foo-bar" {} ''
    mkir $out
    echo "bar" > $out/foo.txt
  '';

  drv4 = pkgs.writeShellScriptBin "hello" ''
    echo "Hello world!"
  '';

  drv5 = pkgs.writeFishBin "hello" ''
    echo "Hello world!"
  '';

  drv6 = pkgs.writeHaskellBin "hello" ''
    main :: IO ()
    main = putStrLn "Hello world!"
  '';

  drv7 = pkgs.writeJSBin "hello" ''
    console.log('Hello world!');
  '';

  drv8 = pkgs.writePerlBin "hello" ''
    print("Hello world!\n");
  '';

  drv9 = pkgs.writePythonBin "hello" ''
    print("Hello world!");
  '';

  drv10 = pkgs.writeRustBin "hello" ''
    fn main() {
      println!("Hello world!");
    }
  '';

  drv11 = {
    nodes = null;
    testScript = ''
      print("Hello world!");
    '';
  };

  mod1 = {
    type = "lua";
    config = ''
      require('nvim-treesitter.config').setup()
    '';
  };
}