Commit 496abdd9
496abdd9f99bMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 2 files · ~2 modified
Description
test: switch fileio/fileopen tests to cwd-relative paths
The hardcoded `/tmp/spinel_test.txt` works on Linux/macOS but not under MSYS2: mingw64 ruby (the reference) raises ENOENT on `/tmp/...` while the spinel-generated native-Windows binary happens to resolve it via msvcrt's fopen — so the harness compared a CRuby error against a successful run and failed.
Cwd-relative paths sidestep the resolution-mismatch entirely. The harness runs each test from the project root sequentially, so the file lands there briefly and is removed by File.delete at the end of each test. Test stdout doesn't include the path, so the byte-for- byte comparison against CRuby is unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- 496abdd9f99b
- Parent
- a09a6b8b339b
test/fileio.rbmodifiedView file
# Test basic File I/O# Test basic File I/O.# Uses cwd-relative paths so the harness (which runs each test from# the project root) and the CRuby reference both write to the same# place on every platform — `/tmp/...` doesn't resolve uniformly# across MSYS2 mingw64 ruby and native-Windows-built spinel binaries.# Write a fileFile.write("/tmp/spinel_test.txt", "Hello from Spinel!\nLine 2\n")File.write("spinel_test.txt", "Hello from Spinel!\nLine 2\n")# Read the filecontent = File.read("/tmp/spinel_test.txt")content = File.read("spinel_test.txt")puts content# File.exist?puts File.exist?("/tmp/spinel_test.txt") # trueputs File.exist?("/tmp/nonexistent.txt") # falseputs File.exist?("spinel_test.txt") # trueputs File.exist?("spinel_nonexistent.txt") # false# Clean upFile.delete("/tmp/spinel_test.txt")puts File.exist?("/tmp/spinel_test.txt") # falseFile.delete("spinel_test.txt")puts File.exist?("spinel_test.txt") # falseputs "done"test/fileopen.rbmodifiedView file
Loading diff…