Preparation for future grammar simplification that may
require parentheses for method calls with arguments on
the right-hand side of assignments.
Co-authored-by: Claude <noreply@anthropic.com>
use chomp to strip line endings from backtick command output, making the
test platform-agnostic. remove unused $crlf variable since line ending
checks are now handled by chomp.
Co-authored-by: Claude <noreply@anthropic.com>
make symlink operations raise notimplementederror on Windows since
symlinks require special privileges and differ significantly from posix.
similarly, filetest.socket? and filetest.symlink? now raise
notimplementederror on Windows since these file types don't exist in
the same way. the file.chmod test now restores write permissions before
deletion, which is required on Windows to delete read-only files.
all tests already have rescue notimplementederror clauses that skip
gracefully on unsupported platforms.
Co-authored-by: Claude <noreply@anthropic.com>
The reason for this is to fix the following problems
- Even on non-Windows, drive letter recognition was still being handled.
- On Windows, paths starting with a slash were not expanded correctly.
- On Windows, relative paths containing drive letters behaved differently than in CRuby.
Due to reimplementation, the internal methods `File._concat_path`, `File._gethome` and `File._getwd` methods have been removed.
The purpose is as follows:
- Stop using `mrb_locale_from_utf8()`.
- Because there is no corresponding `mrb_utf8_from_locale()`.
- Because on Windows, for example, if the code page is 932 (CP932, likely ShiftJIS), it cannot be distinguished from the second byte 0x5c (\), and returns wrong results.
- Stop using `dirname(3)`.
- Because leading consecutive slashes are not truncated.
For example, if `/////a/b` is given, CRuby returns `/a`, but mruby so far returns `/////a`.
- Because the `path` argument cannot be passed in an immutable form.
- Stop using `_splitpath()` in the Windows implementation.
- Because there is no support for UNC paths with up to 32767 characters.
ref. https://learn.microsoft.com/ja-jp/dotnet/standard/io/file-path-formats#unc-paths
- Because modifying the result of paths terminated by a directory separator.
Previously, for example, `C:/` would return `C:.` instead of `C:/`, and `a/b/` would return `a/b` instead of `a`.
Change to `MRB_USE_IO_PREAD_PWRITE` for consistency with mruby configuration macros.
Similarly, `MRB_WITHOUT_IO_PREAD_PWRITE` is changed to `MRB_NO_IO_PREAD_PWRITE`.
The previous names are available for compatibility but are deprecated.
- The inner method `File._gethome` could be read as intending to use the `USERPROFILE` environment variable instead on Windows when the `HOME` environment variable is not available.
In reality, however, this was not the case.
- The result of `File.expand_path` should unify path separators with `/`, but it did not.
Since `mruby-io` does not depend on `mruby-env` even for test builds, it is impossible that `ENV` constants are defined.
Therefore, define `MRubyIOTestUtil::ENV_HOME` for alternative use.
I hit the following two problems.
- `io.read(0, buf)` always returned a new empty string object.
- `io.read(num, buf)` was appending data to the given `buf`.
This also meant that `buf` was never empty if EOF was reached.
* The `Fixnum` constant is now an alias for the `Integer` class.
* Remove `struct mrb_state::fixnum_class` member.
If necessary, use `struct mrb_state::integer_class` instead.