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

Function test_website_examples

web/book/tests/documentation/website.rs:15–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13
14#[test]
15fn test_website_examples() {
16 for example in read_dir("../website/data/examples").unwrap().flatten() {
17 let file = std::fs::File::open(example.path()).unwrap();
18 let example_value: Value = serde_yaml::from_reader(&file).unwrap();
19 let prql = example_value.get("prql").unwrap().as_str().unwrap();
20
21 let compiled_sql = compile(prql).unwrap();
22
23 if let Some(sql) = example_value.get("sql") {
24 assert_eq!(
25 sql_normalize(&compiled_sql),
26 sql_normalize(sql.as_str().unwrap()),
27 "Failed for file: {:?}",
28 example.path()
29 );
30 }
31 }
32}

Callers

nothing calls this directly

Calls 3

as_strMethod · 0.80
compileFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected