about summary refs log tree commit diff
path: root/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-type-predicates.nix
blob: e67b21915923f94b50b25a45b9feffe4ff341d53 (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
let
  # apply is thunked, so we can create a thunked value using the identity function
  thunk = x: x;
in
[
  (builtins.isAttrs { bar = throw "baz"; })
  (builtins.isAttrs (thunk { foo = 13; }))
  (builtins.isAttrs (thunk 123))
  (builtins.isBool true)
  (builtins.isBool (thunk false))
  (builtins.isBool (thunk "lol"))
  (builtins.isFloat 1.2)
  (builtins.isFloat (thunk (1 * 1.0)))
  (builtins.isFloat 1)
  (builtins.isFunction thunk)
  (builtins.isFunction (thunk thunk))
  (builtins.isFunction { })
  (builtins.isInt 1)
  (builtins.isInt (thunk 42))
  (builtins.isInt 1.0)
  (builtins.isList [ (throw "oh no") (abort "it's over") ])
  (builtins.isList (thunk [ 21 21 ]))
  (builtins.isList (thunk { }))
  (builtins.isNull null)
  (builtins.isNull (thunk null))
  (builtins.isNull 42)
  (builtins.isPath ./relative)
  (builtins.isPath (thunk /absolute))
  (builtins.isPath "/not/a/path")
  (builtins.isString "simple")
  (builtins.isString "${{ outPath = "coerced"; }}")
  (builtins.isString "hello ${"interpolation"}")
  (builtins.isString true)
]