cleanup: Remove temporary file ExternCall test code
- Remove file static box from stdlib/mod.rs - Remove file.read/write/exists ExternCall handling from MIR builder - Delete test_file_ffi.nyash test file - Clean build successful
This commit is contained in:
@ -1,46 +0,0 @@
|
||||
// FFI-ABI File I/O test
|
||||
// 純粋FFI-ABI方式でのファイル操作デモ
|
||||
|
||||
using nyashstd
|
||||
|
||||
// テスト用のファイル名
|
||||
local test_file = "test_output.txt"
|
||||
|
||||
// ファイルに書き込み
|
||||
file.write(test_file, "Hello from Nyash FFI-ABI!\nThis is a test of file I/O.")
|
||||
console.log("✅ File written: " + test_file)
|
||||
|
||||
// ファイルの存在確認
|
||||
if file.exists(test_file) {
|
||||
console.log("✅ File exists!")
|
||||
|
||||
// ファイルを読み込み
|
||||
local content = file.read(test_file)
|
||||
if content != null {
|
||||
console.log("✅ File content:")
|
||||
console.log(content)
|
||||
|
||||
// 内容を追記
|
||||
file.write(test_file, content + "\nAdded line at: " + new StringBox("timestamp"))
|
||||
console.log("✅ Content appended")
|
||||
|
||||
// 再度読み込み
|
||||
local updated = file.read(test_file)
|
||||
console.log("✅ Updated content:")
|
||||
console.log(updated)
|
||||
} else {
|
||||
console.log("❌ Failed to read file")
|
||||
}
|
||||
} else {
|
||||
console.log("❌ File does not exist")
|
||||
}
|
||||
|
||||
// 存在しないファイルを読もうとする
|
||||
local missing = file.read("non_existent_file.txt")
|
||||
if missing == null {
|
||||
console.log("✅ Non-existent file correctly returns null")
|
||||
} else {
|
||||
console.log("❌ Unexpected content from non-existent file")
|
||||
}
|
||||
|
||||
console.log("\n🎉 FFI-ABI File I/O test complete!")
|
||||
Reference in New Issue
Block a user