use myc::ast::environment::Environment; use myc::ast::types::Value; #[test] fn test_pipeline_optional_type() { let env = Environment::new(); // The lambda uses an `if` without an `else` returning a float constant. // The TypeChecker should deduce `Optional(Float)` for the lambda body, // and correctly unwrap it to `Series(Float)` for the pipeline output. let source = "(do (def src (create-random-ohlc 42 10)) (def filtered (pipe [src] (fn [tick] (if true 42.0 ) ) ) ) filtered )"; let res = env.run_script(source); if let Err(e) = &res { panic!("Script failed to compile/run: {:?}", e); } let val = res.unwrap(); if let Value::Object(obj) = val { assert_eq!(obj.type_name(), "StreamNode"); } else { panic!("Expected an Object(StreamNode)"); } }