Files
hakorune/src/tests/sugar_pipeline_test.rs
Moe Charm 19f775c34d feat(phase12.7): 糖衣構文Phase 12.7-B完了 + 自律型AI開発システム制御機能
🚀 Phase 12.7-B: ChatGPT5糖衣構文(基本実装完了)
- パイプライン演算子(|>)実装
- セーフアクセス(?.)とデフォルト値(??)実装
- sugar gateによる段階的有効化機能
- 糖衣構文テストスイート追加

🤖 自律型AI開発システム改善
- codex-async-notify.sh: タスク制御指示追加
  - "下の箱を積み過ぎないように先に進んでください"
  - "フェーズが終わったと判断したら止まってください"
- プロセス数表示機能の改善(count_running_codex_display)
- 自動停止機能が正常動作(Phase 12.7-C前で停止確認)

📚 ドキュメント更新
- Paper 13: 自律型AI協調開発システムの革新性を文書化
- ANCP可逆マッピング仕様追加
- nyfmt PoC(フォーマッター)計画追加

🧱 箱理論の体現
- 74k行のコードベース(Phase 15で20k行を目指す)
- ANCP適用で最終的に6k行相当を狙う
- 世界最小の実用コンパイラへの道

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-05 05:16:21 +09:00

40 lines
1.9 KiB
Rust

use crate::parser::entry_sugar::parse_with_sugar_level;
use crate::syntax::sugar_config::SugarLevel;
use crate::ast::ASTNode;
#[test]
fn pipeline_rewrites_function_and_method_calls() {
let code = "result = data |> normalize(1) |> obj.m(2)\n";
let ast = parse_with_sugar_level(code, SugarLevel::Basic).expect("parse ok");
// Program with one assignment
let program = match ast { ASTNode::Program { statements, .. } => statements, other => panic!("expected program, got {:?}", other) };
assert_eq!(program.len(), 1);
let assign = match &program[0] { ASTNode::Assignment { target, value, .. } => (target, value), other => panic!("expected assignment, got {:?}", other) };
// target = result
match assign.0.as_ref() { ASTNode::Variable { name, .. } => assert_eq!(name, "result"), other => panic!("expected target var, got {:?}", other) }
// value should be obj.m( normalize(data,1), 2 )
let (obj_name, method_name, args) = match assign.1.as_ref() {
ASTNode::MethodCall { object, method, arguments, .. } => {
let obj_name = match object.as_ref() { ASTNode::Variable { name, .. } => name.clone(), other => panic!("expected obj var, got {:?}", other) };
(obj_name, method.clone(), arguments.clone())
}
other => panic!("expected method call, got {:?}", other),
};
assert_eq!(obj_name, "obj");
assert_eq!(method_name, "m");
assert_eq!(args.len(), 2);
// first arg should be normalize(data,1)
match &args[0] {
ASTNode::FunctionCall { name, arguments, .. } => {
assert_eq!(name, "normalize");
assert_eq!(arguments.len(), 2);
match &arguments[0] { ASTNode::Variable { name, .. } => assert_eq!(name, "data"), other => panic!("expected var data, got {:?}", other) }
}
other => panic!("expected function call, got {:?}", other),
}
}