about summary refs log tree commit diff
path: root/users/sterni/nix/fun/tests/default.nix
blob: f02f19943373ac2d45db2639196798d7ec502550 (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
{ depot, ... }:

let
  inherit (depot.nix.runTestsuite)
    runTestsuite
    it
    assertEq
    ;

  inherit (depot.users.sterni.nix)
    fun
    ;

  hasEllipsisTests = it "checks fun.hasEllipsis" [
    (assertEq "Malicious string" false
      (fun.hasEllipsis (builtins.toXML ({ foo, ... }: 12))))
    (assertEq "No function" false
      (fun.hasEllipsis 23))
    (assertEq "No attribute set pattern" false
      (fun.hasEllipsis (a: a + 2)))
    (assertEq "No ellipsis" false
      (fun.hasEllipsis ({ foo, bar }: foo + bar)))
    (assertEq "Ellipsis" true
      (fun.hasEllipsis ({ depot, pkgs, ... }: 42)))
  ];
in
runTestsuite "nix.fun" [
  hasEllipsisTests
]