Files
hakorune/test_buffer_box.nyash
Moe Charm 0c786a8ac6 🔥 feat: Arc<Mutex> Revolution完全達成 - 全Box型統一実装
## 🎯 主要な変更
- ArrayBoxをArc<Mutex>パターンで完全再実装
- 全メソッドが`&self`で統一(push, pop, get, set等)
- Box<dyn NyashBox>引数対応でNyashから使用可能に

##  修正内容
- ArrayBox: 完全なArc<Mutex>実装に置き換え
- BufferBox: ArrayBoxとの連携修正、デバッグ出力削除
- StringBox: 新しいArrayBoxインポートに修正
- RandomBox: 新しいArrayBoxインポートに修正
- box_trait.rs: 古いArrayBox定義を削除しre-export追加

## 🧪 テスト追加
- test_buffer_box.nyash: BufferBox動作確認
- test_random_box.nyash: RandomBox動作確認
- test_new_boxes.nyash: 包括的Box機能テスト修正

##  確認済み動作
- ArrayBox: push/pop/get/set/join等全メソッド
- BufferBox: write/readAll/length
- RandomBox: choice/shuffle等配列操作
- JSONBox/RegexBox: 既に正しく実装済み

🚀 全Box型がArc<Mutex>パターンで統一完了!

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-10 16:46:39 +09:00

27 lines
561 B
Plaintext

// 🧪 BufferBoxのテスト
print("=== BufferBox Test ===")
local buffer, data, result
// BufferBox作成
buffer = new BufferBox()
// データ配列作成
data = new ArrayBox()
data.push(72) // 'H'
data.push(101) // 'e'
data.push(108) // 'l'
data.push(108) // 'l'
data.push(111) // 'o'
// データ書き込み
result = buffer.write(data)
print("Write result: " + result)
print("Buffer length: " + buffer.length())
// データ読み取り
local readData
readData = buffer.readAll()
print("Read data: " + readData)
print("BufferBox test completed!")