MCPcopy Create free account
hub / github.com/PRQL/prql / test_aggregate

Function test_aggregate

prqlc/prqlc-parser/src/test.rs:294–388  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

292
293#[test]
294fn test_aggregate() {
295 let aggregate = parse_source(
296 r"group {title} (
297 aggregate {sum salary, count}
298 )",
299 )
300 .unwrap();
301 assert_yaml_snapshot!(
302 aggregate, @r#"
303 - VarDef:
304 kind: Main
305 name: main
306 value:
307 FuncCall:
308 name:
309 Ident:
310 - group
311 span: "0:0-5"
312 args:
313 - Tuple:
314 - Ident:
315 - title
316 span: "0:7-12"
317 span: "0:6-13"
318 - FuncCall:
319 name:
320 Ident:
321 - aggregate
322 span: "0:32-41"
323 args:
324 - Tuple:
325 - FuncCall:
326 name:
327 Ident:
328 - sum
329 span: "0:43-46"
330 args:
331 - Ident:
332 - salary
333 span: "0:47-53"
334 span: "0:43-53"
335 - Ident:
336 - count
337 span: "0:55-60"
338 span: "0:42-61"
339 span: "0:32-61"
340 span: "0:0-77"
341 span: "0:0-77"
342 "#);
343 let aggregate = parse_source(
344 r"group {title} (
345 aggregate {sum salary}
346 )",
347 )
348 .unwrap();
349 assert_yaml_snapshot!(
350 aggregate, @r#"
351 - VarDef:

Callers

nothing calls this directly

Calls 1

parse_sourceFunction · 0.70

Tested by

no test coverage detected