File: slice.json

package info (click to toggle)
golang-github-jmespath-go-jmespath 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, experimental, sid
  • size: 3,564 kB
  • sloc: makefile: 39; sh: 23
file content (187 lines) | stat: -rw-r--r-- 3,639 bytes parent folder | download | duplicates (12)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
[{
  "given": {
    "foo": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
    "bar": {
      "baz": 1
    }
  },
  "cases": [
    {
      "expression": "bar[0:10]",
      "result": null
    },
    {
      "expression": "foo[0:10:1]",
      "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    },
    {
      "expression": "foo[0:10]",
      "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    },
    {
      "expression": "foo[0:10:]",
      "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    },
    {
      "expression": "foo[0::1]",
      "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    },
    {
      "expression": "foo[0::]",
      "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    },
    {
      "expression": "foo[0:]",
      "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    },
    {
      "expression": "foo[:10:1]",
      "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    },
    {
      "expression": "foo[::1]",
      "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    },
    {
      "expression": "foo[:10:]",
      "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    },
    {
      "expression": "foo[::]",
      "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    },
    {
      "expression": "foo[:]",
      "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    },
    {
      "expression": "foo[1:9]",
      "result": [1, 2, 3, 4, 5, 6, 7, 8]
    },
    {
      "expression": "foo[0:10:2]",
      "result": [0, 2, 4, 6, 8]
    },
    {
      "expression": "foo[5:]",
      "result": [5, 6, 7, 8, 9]
    },
    {
      "expression": "foo[5::2]",
      "result": [5, 7, 9]
    },
    {
      "expression": "foo[::2]",
      "result": [0, 2, 4, 6, 8]
    },
    {
      "expression": "foo[::-1]",
      "result": [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
    },
    {
      "expression": "foo[1::2]",
      "result": [1, 3, 5, 7, 9]
    },
    {
      "expression": "foo[10:0:-1]",
      "result": [9, 8, 7, 6, 5, 4, 3, 2, 1]
    },
    {
      "expression": "foo[10:5:-1]",
      "result": [9, 8, 7, 6]
    },
    {
      "expression": "foo[8:2:-2]",
      "result": [8, 6, 4]
    },
    {
      "expression": "foo[0:20]",
      "result": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    },
    {
      "expression": "foo[10:-20:-1]",
      "result": [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
    },
    {
      "expression": "foo[10:-20]",
      "result": []
    },
    {
      "expression": "foo[-4:-1]",
      "result": [6, 7, 8]
    },
    {
      "expression": "foo[:-5:-1]",
      "result": [9, 8, 7, 6]
    },
    {
      "expression": "foo[8:2:0]",
      "error": "invalid-value"
    },
    {
      "expression": "foo[8:2:0:1]",
      "error": "syntax"
    },
    {
      "expression": "foo[8:2&]",
      "error": "syntax"
    },
    {
      "expression": "foo[2:a:3]",
      "error": "syntax"
    }
  ]
}, {
  "given": {
    "foo": [{"a": 1}, {"a": 2}, {"a": 3}],
    "bar": [{"a": {"b": 1}}, {"a": {"b": 2}},
	    {"a": {"b": 3}}],
    "baz": 50
  },
  "cases": [
    {
      "expression": "foo[:2].a",
      "result": [1, 2]
    },
    {
      "expression": "foo[:2].b",
      "result": []
    },
    {
      "expression": "foo[:2].a.b",
      "result": []
    },
    {
      "expression": "bar[::-1].a.b",
      "result": [3, 2, 1]
    },
    {
      "expression": "bar[:2].a.b",
      "result": [1, 2]
    },
    {
      "expression": "baz[:2].a",
      "result": null
    }
  ]
}, {
  "given": [{"a": 1}, {"a": 2}, {"a": 3}],
  "cases": [
    {
      "expression": "[:]",
      "result": [{"a": 1}, {"a": 2}, {"a": 3}]
    },
    {
      "expression": "[:2].a",
      "result": [1, 2]
    },
    {
      "expression": "[::-1].a",
      "result": [3, 2, 1]
    },
    {
      "expression": "[:2].b",
      "result": []
    }
  ]
}]