about summary refs log tree commit diff
path: root/third_party/nix/src/tests/lang/eval-okay-types.nix
blob: cc51d8cb7a25aaf427a57efd90152ed2408067cb (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
with builtins;

[ (isNull null)
  (isNull (x: x))
  (isFunction (x: x))
  (isFunction functionArgs)
  (isFunction "fnord")
  (isString ("foo" + "bar"))
  (isString [ "x" ])
  (isInt (1 + 2))
  (isInt { x = 123; })
  (isInt (1 / 2))
  (isInt (1 + 1))
  (isInt (1 / 2))
  (isInt (1 * 2))
  (isInt (1 - 2))
  (isFloat (1.2))
  (isFloat (1 + 1.0))
  (isFloat (1 / 2.0))
  (isFloat (1 * 2.0))
  (isFloat (1 - 2.0))
  (isBool (true && false))
  (isBool null)
  (isPath /nix/store)
  (isPath ./.)
  (isAttrs { x = 123; })
  (isAttrs null)
  (typeOf (3 * 4))
  (typeOf true)
  (typeOf "xyzzy")
  (typeOf null)
  (typeOf { x = 456; })
  (typeOf [ 1 2 3 ])
  (typeOf (x: x))
  (typeOf ((x: y: x) 1))
  (typeOf map)
  (typeOf (map (x: x)))
]