feat: Complete VM plugin E2E tests with ResultBox support

 All E2E tests passing:
- e2e_vm_plugin_filebox_copy_from_handle: Handle arguments (tag=8) working
- e2e_vm_http_get_basic: GET with ResultBox.get_value() working
- e2e_vm_http_post_and_headers: POST with status/headers/body verified (201:V:R)

Key achievement:
- VM already had ResultBox methods (is_ok/get_value/get_error) implemented
- HTTP plugin methods now correctly return values through ResultBox
- Full VM×Plugin integration verified

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-23 05:27:18 +09:00
parent 63749b683e
commit 3b03d001ba
3 changed files with 73 additions and 1 deletions

View File

@ -1098,7 +1098,24 @@ impl VM {
fn call_box_method(&self, box_value: Box<dyn NyashBox>, method: &str, _args: Vec<Box<dyn NyashBox>>) -> Result<Box<dyn NyashBox>, VMError> {
// For now, implement basic methods for common box types
// This is a simplified version - real implementation would need full method dispatch
// ResultBox (NyashResultBox) methods
if let Some(result_box) = box_value.as_any().downcast_ref::<crate::boxes::result::NyashResultBox>() {
match method {
// Rust側の公開APIメソッド名に合わせたバリアントを許容
"is_ok" | "isOk" => {
return Ok(result_box.is_ok());
}
"get_value" | "getValue" => {
return Ok(result_box.get_value());
}
"get_error" | "getError" => {
return Ok(result_box.get_error());
}
_ => return Ok(Box::new(VoidBox::new())),
}
}
// StringBox methods
if let Some(string_box) = box_value.as_any().downcast_ref::<StringBox>() {
match method {