|
68 | 68 | "error": "invalid-type"
|
69 | 69 | },
|
70 | 70 | {
|
71 |
| - "expression": "avg(`abc`)", |
| 71 | + "expression": "avg('abc')", |
72 | 72 | "error": "invalid-type"
|
73 | 73 | },
|
74 | 74 | {
|
|
100 | 100 | "result": -1
|
101 | 101 | },
|
102 | 102 | {
|
103 |
| - "expression": "ceil(`string`)", |
| 103 | + "expression": "ceil('string')", |
104 | 104 | "error": "invalid-type"
|
105 | 105 | },
|
106 | 106 | {
|
107 |
| - "expression": "contains(`abc`, `a`)", |
| 107 | + "expression": "contains('abc', 'a')", |
108 | 108 | "result": true
|
109 | 109 | },
|
110 | 110 | {
|
111 |
| - "expression": "contains(`abc`, `d`)", |
| 111 | + "expression": "contains('abc', 'd')", |
112 | 112 | "result": false
|
113 | 113 | },
|
114 | 114 | {
|
115 |
| - "expression": "contains(`false`, `d`)", |
| 115 | + "expression": "contains(`false`, 'd')", |
116 | 116 | "error": "invalid-type"
|
117 | 117 | },
|
118 | 118 | {
|
119 |
| - "expression": "contains(strings, `a`)", |
| 119 | + "expression": "contains(strings, 'a')", |
120 | 120 | "result": true
|
121 | 121 | },
|
122 | 122 | {
|
|
128 | 128 | "result": false
|
129 | 129 | },
|
130 | 130 | {
|
131 |
| - "expression": "ends_with(str, `r`)", |
| 131 | + "expression": "ends_with(str, 'r')", |
132 | 132 | "result": true
|
133 | 133 | },
|
134 | 134 | {
|
135 |
| - "expression": "ends_with(str, `tr`)", |
| 135 | + "expression": "ends_with(str, 'tr')", |
136 | 136 | "result": true
|
137 | 137 | },
|
138 | 138 | {
|
139 |
| - "expression": "ends_with(str, `Str`)", |
| 139 | + "expression": "ends_with(str, 'Str')", |
140 | 140 | "result": true
|
141 | 141 | },
|
142 | 142 | {
|
143 |
| - "expression": "ends_with(str, `SStr`)", |
| 143 | + "expression": "ends_with(str, 'SStr')", |
144 | 144 | "result": false
|
145 | 145 | },
|
146 | 146 | {
|
147 |
| - "expression": "ends_with(str, `foo`)", |
| 147 | + "expression": "ends_with(str, 'foo')", |
148 | 148 | "result": false
|
149 | 149 | },
|
150 | 150 | {
|
|
156 | 156 | "result": 1
|
157 | 157 | },
|
158 | 158 | {
|
159 |
| - "expression": "floor(`string`)", |
| 159 | + "expression": "floor('string')", |
160 | 160 | "error": "invalid-type"
|
161 | 161 | },
|
162 | 162 | {
|
|
172 | 172 | "error": "invalid-type"
|
173 | 173 | },
|
174 | 174 | {
|
175 |
| - "expression": "length(`abc`)", |
| 175 | + "expression": "length('abc')", |
176 | 176 | "result": 3
|
177 | 177 | },
|
178 | 178 | {
|
179 |
| - "expression": "length(`\"\"`)", |
| 179 | + "expression": "length('')", |
180 | 180 | "result": 0
|
181 | 181 | },
|
182 | 182 | {
|
|
239 | 239 | "expression": "max(empty_list)",
|
240 | 240 | "result": null
|
241 | 241 | },
|
| 242 | + { |
| 243 | + "expression": "merge(`{}`)", |
| 244 | + "result": {} |
| 245 | + }, |
| 246 | + { |
| 247 | + "expression": "merge(`{}`, `{}`)", |
| 248 | + "result": {} |
| 249 | + }, |
| 250 | + { |
| 251 | + "expression": "merge(`{\"a\": 1}`, `{\"b\": 2}`)", |
| 252 | + "result": {"a": 1, "b": 2} |
| 253 | + }, |
| 254 | + { |
| 255 | + "expression": "merge(`{\"a\": 1}`, `{\"a\": 2}`)", |
| 256 | + "result": {"a": 2} |
| 257 | + }, |
| 258 | + { |
| 259 | + "expression": "merge(`{\"a\": 1, \"b\": 2}`, `{\"a\": 2, \"c\": 3}`, `{\"d\": 4}`)", |
| 260 | + "result": {"a": 2, "b": 2, "c": 3, "d": 4} |
| 261 | + }, |
242 | 262 | {
|
243 | 263 | "expression": "min(numbers)",
|
244 | 264 | "result": -1
|
|
268 | 288 | "result": "a"
|
269 | 289 | },
|
270 | 290 | {
|
271 |
| - "expression": "type(`abc`)", |
| 291 | + "expression": "type('abc')", |
272 | 292 | "result": "string"
|
273 | 293 | },
|
274 | 294 | {
|
|
332 | 352 | "error": "invalid-type"
|
333 | 353 | },
|
334 | 354 | {
|
335 |
| - "expression": "join(`\", \"`, strings)", |
| 355 | + "expression": "join(', ', strings)", |
336 | 356 | "result": "a, b, c"
|
337 | 357 | },
|
338 | 358 | {
|
339 |
| - "expression": "join(`, `, strings)", |
| 359 | + "expression": "join(', ', strings)", |
340 | 360 | "result": "a, b, c"
|
341 | 361 | },
|
342 | 362 | {
|
343 |
| - "expression": "join(`,`, `[\"a\", \"b\"]`)", |
| 363 | + "expression": "join(',', `[\"a\", \"b\"]`)", |
344 | 364 | "result": "a,b"
|
345 | 365 | },
|
346 | 366 | {
|
347 |
| - "expression": "join(`,`, `[\"a\", 0]`)", |
| 367 | + "expression": "join(',', `[\"a\", 0]`)", |
348 | 368 | "error": "invalid-type"
|
349 | 369 | },
|
350 | 370 | {
|
351 |
| - "expression": "join(`, `, str)", |
| 371 | + "expression": "join(', ', str)", |
352 | 372 | "error": "invalid-type"
|
353 | 373 | },
|
354 | 374 | {
|
355 |
| - "expression": "join(`|`, strings)", |
| 375 | + "expression": "join('|', strings)", |
356 | 376 | "result": "a|b|c"
|
357 | 377 | },
|
358 | 378 | {
|
359 | 379 | "expression": "join(`2`, strings)",
|
360 | 380 | "error": "invalid-type"
|
361 | 381 | },
|
362 | 382 | {
|
363 |
| - "expression": "join(`|`, decimals)", |
| 383 | + "expression": "join('|', decimals)", |
364 | 384 | "error": "invalid-type"
|
365 | 385 | },
|
366 | 386 | {
|
367 |
| - "expression": "join(`|`, decimals[].to_string(@))", |
| 387 | + "expression": "join('|', decimals[].to_string(@))", |
368 | 388 | "result": "1.01|1.2|-1.5"
|
369 | 389 | },
|
370 | 390 | {
|
371 |
| - "expression": "join(`|`, empty_list)", |
| 391 | + "expression": "join('|', empty_list)", |
372 | 392 | "result": ""
|
373 | 393 | },
|
374 | 394 | {
|
|
384 | 404 | "result": []
|
385 | 405 | },
|
386 | 406 | {
|
387 |
| - "expression": "reverse(``)", |
| 407 | + "expression": "reverse('')", |
388 | 408 | "result": ""
|
389 | 409 | },
|
390 | 410 | {
|
391 |
| - "expression": "reverse(`hello world`)", |
| 411 | + "expression": "reverse('hello world')", |
392 | 412 | "result": "dlrow olleh"
|
393 | 413 | },
|
394 | 414 | {
|
395 |
| - "expression": "starts_with(str, `S`)", |
| 415 | + "expression": "starts_with(str, 'S')", |
396 | 416 | "result": true
|
397 | 417 | },
|
398 | 418 | {
|
399 |
| - "expression": "starts_with(str, `St`)", |
| 419 | + "expression": "starts_with(str, 'St')", |
400 | 420 | "result": true
|
401 | 421 | },
|
402 | 422 | {
|
403 |
| - "expression": "starts_with(str, `Str`)", |
| 423 | + "expression": "starts_with(str, 'Str')", |
404 | 424 | "result": true
|
405 | 425 | },
|
406 | 426 | {
|
407 |
| - "expression": "starts_with(str, `String`)", |
| 427 | + "expression": "starts_with(str, 'String')", |
408 | 428 | "result": false
|
409 | 429 | },
|
410 | 430 | {
|
|
432 | 452 | "result": 0
|
433 | 453 | },
|
434 | 454 | {
|
435 |
| - "expression": "to_string(`foo`)", |
| 455 | + "expression": "to_array('foo')", |
| 456 | + "result": ["foo"] |
| 457 | + }, |
| 458 | + { |
| 459 | + "expression": "to_array(`0`)", |
| 460 | + "result": [0] |
| 461 | + }, |
| 462 | + { |
| 463 | + "expression": "to_array(objects)", |
| 464 | + "result": [{"foo": "bar", "bar": "baz"}] |
| 465 | + }, |
| 466 | + { |
| 467 | + "expression": "to_array(`[1, 2, 3]`)", |
| 468 | + "result": [1, 2, 3] |
| 469 | + }, |
| 470 | + { |
| 471 | + "expression": "to_array(false)", |
| 472 | + "result": [false] |
| 473 | + }, |
| 474 | + { |
| 475 | + "expression": "to_string('foo')", |
436 | 476 | "result": "foo"
|
437 | 477 | },
|
438 | 478 | {
|
|
444 | 484 | "result": "[0,1]"
|
445 | 485 | },
|
446 | 486 | {
|
447 |
| - "expression": "to_number(`\"1.0\"`)", |
| 487 | + "expression": "to_number('1.0')", |
448 | 488 | "result": 1.0
|
449 | 489 | },
|
450 | 490 | {
|
451 |
| - "expression": "to_number(`\"1.1\"`)", |
| 491 | + "expression": "to_number('1.1')", |
452 | 492 | "result": 1.1
|
453 | 493 | },
|
454 | 494 | {
|
455 |
| - "expression": "to_number(`\"4\"`)", |
| 495 | + "expression": "to_number('4')", |
456 | 496 | "result": 4
|
457 | 497 | },
|
458 | 498 | {
|
459 |
| - "expression": "to_number(`\"notanumber\"`)", |
| 499 | + "expression": "to_number('notanumber')", |
460 | 500 | "result": null
|
461 | 501 | },
|
462 | 502 | {
|
|
569 | 609 | },
|
570 | 610 | "cases": [
|
571 | 611 | {
|
572 |
| - "description": "function projection on variadic function", |
| 612 | + "description": "sort by field expression", |
573 | 613 | "expression": "sort_by(people, &age)",
|
574 | 614 | "result": [
|
575 | 615 | {"age": 10, "age_str": "10", "bool": true, "name": 3},
|
|
580 | 620 | ]
|
581 | 621 | },
|
582 | 622 | {
|
583 |
| - "description": "function projection on variadic function", |
| 623 | + "description": "sort by function expression", |
584 | 624 | "expression": "sort_by(people, &to_number(age_str))",
|
585 | 625 | "result": [
|
586 | 626 | {"age": 10, "age_str": "10", "bool": true, "name": 3},
|
|
591 | 631 | ]
|
592 | 632 | },
|
593 | 633 | {
|
594 |
| - "description": "function projection on variadic function", |
| 634 | + "description": "function projection on sort_by function", |
595 | 635 | "expression": "sort_by(people, &age)[].name",
|
596 | 636 | "result": [3, "a", "c", "b", "d"]
|
597 | 637 | },
|
|
615 | 655 | "expression": "sort_by(people, &age)[].extra",
|
616 | 656 | "result": ["foo", "bar"]
|
617 | 657 | },
|
| 658 | + { |
| 659 | + "expression": "sort_by(`[]`, &age)", |
| 660 | + "result": [] |
| 661 | + }, |
618 | 662 | {
|
619 | 663 | "expression": "max_by(people, &age)",
|
620 | 664 | "result": {"age": 50, "age_str": "50", "bool": false, "name": "d"}
|
|
0 commit comments