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

Function test_module

prqlc/prqlc/src/semantic/module.rs:496–511  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

494 // TODO: tests / docstrings for `stack_pop` & `stack_push` & `insert_frame`
495 #[test]
496 fn test_module() {
497 let mut module = Module::default();
498
499 let ident = Ident::from_name("test_name");
500 let expr: Expr = Expr::new(ExprKind::Literal(Literal::Integer(42)));
501 let decl: Decl = DeclKind::Expr(Box::new(expr)).into();
502
503 assert!(module.insert(ident.clone(), decl.clone()).is_ok());
504 assert_eq!(module.get(&ident).unwrap(), &decl);
505 assert_eq!(module.get_mut(&ident).unwrap(), &decl);
506
507 // Lookup
508 let lookup_result = module.lookup(&ident);
509 assert_eq!(lookup_result.len(), 1);
510 assert!(lookup_result.contains(&ident));
511 }
512
513 #[test]
514 fn test_module_shadow_unshadow() {

Callers

nothing calls this directly

Calls 3

LiteralEnum · 0.85
lookupMethod · 0.80
ExprClass · 0.50

Tested by

no test coverage detected