()
| 629 | |
| 630 | #[test] |
| 631 | fn test_local_put_and_get() -> Result<()> { |
| 632 | let upcalls = HashMap::default(); |
| 633 | let mut global = GlobalSymtable::new(upcalls); |
| 634 | let mut local = global.enter_scope(); |
| 635 | |
| 636 | let reg = |
| 637 | local.put_local(SymbolKey::from("a"), SymbolPrototype::Scalar(ExprType::Boolean))?; |
| 638 | assert_eq!(Register::local(0).unwrap(), reg); |
| 639 | |
| 640 | let reg = |
| 641 | local.put_local(SymbolKey::from("b"), SymbolPrototype::Scalar(ExprType::Double))?; |
| 642 | assert_eq!(Register::local(1).unwrap(), reg); |
| 643 | |
| 644 | let (reg, proto) = local.get_local_or_global(&VarRef::new("a", None))?; |
| 645 | assert_eq!(Register::local(0).unwrap(), reg); |
| 646 | assert_eq!(SymbolPrototype::Scalar(ExprType::Boolean), proto); |
| 647 | |
| 648 | Ok(()) |
| 649 | } |
| 650 | |
| 651 | #[test] |
| 652 | fn test_local_shadows_global() -> Result<()> { |
nothing calls this directly
no test coverage detected