mirror of
https://github.com/wader/fq.git
synced 2024-11-26 21:55:57 +03:00
30 lines
601 B
Plaintext
30 lines
601 B
Plaintext
include "assert";
|
|
include "funcs";
|
|
|
|
(
|
|
([
|
|
".",
|
|
".a",
|
|
".a[0]",
|
|
".a[123].bb",
|
|
".[123].a",
|
|
".[123][123].a",
|
|
".\"b b\"",
|
|
".\"a \\\\ b\"",
|
|
".\"a \\\" b\""
|
|
][] | assert("\(.) | expr_to_path | path_to_expr"; .; expr_to_path | path_to_expr))
|
|
,
|
|
([
|
|
[[], []],
|
|
[[1], [[1]]],
|
|
[[1,1], [[1,1]]],
|
|
[[1,1,2], [[1,1],[2]]],
|
|
[[1,1,2,2], [[1,1],[2,2]]],
|
|
[[1,2,2,1], [[1],[2,2],[1]]]
|
|
][] | assert("\(.) | chunk"; .[1]; .[0] | chunk))
|
|
,
|
|
([
|
|
[[{a:1},{a:1},{a:2}], [[{a:1},{a:1}],[{a:2}]]]
|
|
][] | assert("\(.) | chunk_by"; .[1]; .[0] | chunk_by(.a)))
|
|
)
|