From 526d262770d4b0182a8dfd5961fbc965e93bbc53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 24 Mar 2020 13:57:52 +0800 Subject: =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=97=B6=E6=A3=80=E6=9F=A5=E4=BA=8C?= =?UTF-8?q?=E8=BF=9B=E5=88=B6=E7=89=88=E6=9C=AC=E4=B8=8Earch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/other/fs.lua | 11 +++++++++++ test/other/init.lua | 12 +----------- test/other/ver.lua | 27 +++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 test/other/fs.lua create mode 100644 test/other/ver.lua (limited to 'test/other') diff --git a/test/other/fs.lua b/test/other/fs.lua new file mode 100644 index 00000000..069a2454 --- /dev/null +++ b/test/other/fs.lua @@ -0,0 +1,11 @@ +local fs = require 'bee.filesystem' +local platform = require 'bee.platform' +local path = fs.path '/a/b/c/d/e/../../../..' +local absolute = fs.absolute(path) +if platform.OS == 'Windows' then + assert(absolute:string():sub(-2) == '/a', absolute:string()) +elseif platform.OS == 'Linux' then + assert(absolute:string():sub(-3) == '/a/', absolute:string()) +elseif platform.OS == 'macOS' then + -- 不支持 +end diff --git a/test/other/init.lua b/test/other/init.lua index 069a2454..9e2b2cfb 100644 --- a/test/other/init.lua +++ b/test/other/init.lua @@ -1,11 +1 @@ -local fs = require 'bee.filesystem' -local platform = require 'bee.platform' -local path = fs.path '/a/b/c/d/e/../../../..' -local absolute = fs.absolute(path) -if platform.OS == 'Windows' then - assert(absolute:string():sub(-2) == '/a', absolute:string()) -elseif platform.OS == 'Linux' then - assert(absolute:string():sub(-3) == '/a/', absolute:string()) -elseif platform.OS == 'macOS' then - -- 不支持 -end +require 'other.ver' diff --git a/test/other/ver.lua b/test/other/ver.lua new file mode 100644 index 00000000..83abcb26 --- /dev/null +++ b/test/other/ver.lua @@ -0,0 +1,27 @@ +local platform = require 'bee.platform' + +assert(_VERSION == 'Lua 5.4', '必须是 Lua 5.4') + +local arch = (function() + if string.packsize then + local size = string.packsize "T" + if size == 8 then + return 64 + end + if size == 4 then + return 32 + end + else + if platform ~= "windows" then + return 64 + end + local size = #tostring(io.stderr) + if size <= 15 then + return 32 + end + return 64 + end + assert(false, "unknown arch") +end)() + +assert(arch == 64, '必须是 x84_64') -- cgit v1.2.3