| 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() { |