MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / typing_recursion

Function typing_recursion

crates/expr/src/statement.rs:557–574  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

555 /// Exercise the limit [`recursion::MAX_RECURSION_TYP_EXPR`]
556 #[test]
557 fn typing_recursion() {
558 let build_query = |total, sep: char| {
559 let mut expr = SqlExpr::Lit(SqlLiteral::Bool(true));
560 for _ in 1..total {
561 let next = SqlExpr::Log(
562 Box::new(SqlExpr::Lit(SqlLiteral::Bool(true))),
563 Box::new(SqlExpr::Lit(SqlLiteral::Bool(false))),
564 LogOp::And,
565 );
566 expr = SqlExpr::Log(Box::new(expr), Box::new(next), LogOp::And);
567 }
568 type_expr(&Relvars::default(), expr, Some(&AlgebraicType::Bool))
569 .map_err(|e| e.to_string().split(sep).next().unwrap_or_default().to_string())
570 };
571 assert_eq!(build_query(2_501, ','), Err("Recursion limit exceeded".to_string()));
572
573 assert!(build_query(2_500, ',').is_ok());
574 }
575
576 #[test]
577 fn views() {

Callers

nothing calls this directly

Calls 7

type_exprFunction · 0.85
splitMethod · 0.80
BoolClass · 0.50
LogClass · 0.50
newFunction · 0.50
to_stringMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…