summaryrefslogtreecommitdiff
path: root/tests/examplefiles/jsonnet/example.jsonnet
blob: 74e2e4599338aa12e04085e8f38d36ed588ac132 (plain)
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
71
72
73
74
/* Multiline /
comment */
local x = 100;
/* Multiline
comment */

/**
 * Docs
 **/


local i = import 'foo';
local foo = 'bar';
local lambda = function(foo, bar) ['baz', 'qux'];
local named(foo, bar=10, baz=20) = ['baz', 'qux'];
local in1troduction = 'introduction';
assert 5 > 3: "interesting";
//comment
{
  local foo = "bar",
  spam: 'eggs',
}

{local foo = "bar"}


{
  // this is a comment
  # python-style comment
  assert 1 == 1: 'huh?',
  spam: 'eggs // /* #',
  spam2(foo, bar):: 2,
  spa: 'eggs',
  foo: 'bar',
  block: |||
    Hello
    Block
  |||,
  baz: 'qux' + 'fuzz',
  'm:oo': 'cow',
  "b:oo": ('cow'),
  goo: ['bar', 'ba\nz'],
  spam3: 2.25,
  spam4::: -2.25,
  spam5::: +2.25,
  spam6//funky
  : 'hello' //moo
    , //moo
  ['spa\'m']: 'eggs',
  ["spa\"m2"]: "eggs",
  raw1: @'hello\',
  raw2: @"hello\",
  spam7: foo,
  spam8: lambda(1, 2),
  spam9: self.spam2(3, 4),
  intro: in1troduction,
  spam_10: 10,
  spam_11(y=10):: 11,
  spam12: std.type('null'),
  spam13+: 27,
  spam14: $.spam13,
  spam15: ~5,
  spam16: !false,
  spam17: 0 - 5,
  spam18: 5 & 3,
  spam19: 5 | 3,
  spam20: 5 ^ 3,
  spam21: 5 == 3,
  spam22: 5 < 3,
  spam23: 5 > 3,
  spam24: 5 * 3,
  spam25: 5 / 3,
  spam26: 5 % 3,
}