diff options
| author | ruki <[email protected]> | 2019-08-19 23:56:37 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-08-19 17:39:42 +0800 |
| commit | 9bb52f37ef2c92b1f69023f183616323516ce1fc (patch) | |
| tree | cf210b7ff7c73b39231c1d2c20b512189d17411d | |
| parent | 905b289ecf007df7d30bcdcee927e46931639ea8 (diff) | |
fix test
| -rw-r--r-- | tests/modules/io/test.lua | 4 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/io.lua | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/modules/io/test.lua b/tests/modules/io/test.lua index cb893b490..e4c6f23e1 100644 --- a/tests/modules/io/test.lua +++ b/tests/modules/io/test.lua @@ -41,7 +41,7 @@ function test_readlines(t) function get_all_without_crlf(file, opt) local r = {} local fp = io.open(file, "r", opt) - for l in fp:lines() do + for l in fp:lines(opt) do table.insert(r, l) end t:require(fp:close()) @@ -58,7 +58,7 @@ function test_readlines(t) t:are_equal(get_all_without_crlf("files/utf8bom-lf-eleof"), {"123\\", "456", "789"}) t:are_equal(get_all_without_crlf("files/utf8-crlf-neleof"), {"123\\", "456", "789"}) t:are_equal(get_all_without_crlf("files/utf8-crlf-neleof", {encoding = "binary"}), {"123\\\r\n", "456\r\n", "789"}) - t:are_equal(get_all_without_crlf("files/utf8-crlf-neleof", {continuation = "\\"}), {"123\\", "456", "789"}) + t:are_equal(get_all_without_crlf("files/utf8-crlf-neleof", {continuation = "\\"}), {"123456", "789"}) t:are_equal(get_all_without_crlf("files/utf16be-lf-eleof"), {"123\\", "456", "789"}) t:are_equal(get_all_without_crlf("files/utf16le-crlf-neleof"), {"123\\", "456", "789"}) end diff --git a/xmake/core/sandbox/modules/io.lua b/xmake/core/sandbox/modules/io.lua index 3d6a12011..8082a5299 100644 --- a/xmake/core/sandbox/modules/io.lua +++ b/xmake/core/sandbox/modules/io.lua @@ -29,9 +29,9 @@ local vformat = require("sandbox/modules/vformat") local sandbox_io = sandbox_io or {} local sandbox_io_file = sandbox_io_file or {} local sandbox_io_filelock = sandbox_io_filelock or {} -sandbox_io._file = sandbox_io._file or io._file -sandbox_io._filelock = sandbox_io._filelock or io._filelock -sandbox_io.lines = io.lines +sandbox_io._file = sandbox_io._file or io._file +sandbox_io._filelock = sandbox_io._filelock or io._filelock +sandbox_io.lines = io.lines -- get file size function sandbox_io_file.size(file) |
