diff options
Diffstat (limited to 'server/test/vm')
-rw-r--r-- | server/test/vm/dirty.lua | 7 | ||||
-rw-r--r-- | server/test/vm/example.lua | 16 | ||||
-rw-r--r-- | server/test/vm/init.lua | 17 | ||||
-rw-r--r-- | server/test/vm/normal.lua | 128 |
4 files changed, 0 insertions, 168 deletions
diff --git a/server/test/vm/dirty.lua b/server/test/vm/dirty.lua deleted file mode 100644 index 9c2e65fb..00000000 --- a/server/test/vm/dirty.lua +++ /dev/null @@ -1,7 +0,0 @@ -TEST [[ -a. -]] - -TEST [[ -a: -]] diff --git a/server/test/vm/example.lua b/server/test/vm/example.lua deleted file mode 100644 index 9a2939b5..00000000 --- a/server/test/vm/example.lua +++ /dev/null @@ -1,16 +0,0 @@ -local fs = require 'bee.filesystem' - -TEST(io.load(ROOT / 'src' / 'core' / 'vm.lua')) - --- 临时 -local function testIfExit(path) - local buf = io.load(fs.path(path)) - if buf then - local clock = os.clock() - for _ = 1, 10 do - TEST(buf) - end - print('基准测试耗时:', os.clock() - clock) - end -end ---testIfExit(ROOT / 'test' / 'example' / 'vm.lua') diff --git a/server/test/vm/init.lua b/server/test/vm/init.lua deleted file mode 100644 index 6e7dc3ac..00000000 --- a/server/test/vm/init.lua +++ /dev/null @@ -1,17 +0,0 @@ -local core = require 'core' -local parser = require 'parser' - -rawset(_G, 'TEST', true) - -function TEST(script) - local ast = parser:ast(script) - assert(ast) - local vm = core.vm(ast) - assert(vm) - local results = vm.results - assert(results) -end - -require 'vm.normal' -require 'vm.example' -require 'vm.dirty' diff --git a/server/test/vm/normal.lua b/server/test/vm/normal.lua deleted file mode 100644 index 02b1f4f0..00000000 --- a/server/test/vm/normal.lua +++ /dev/null @@ -1,128 +0,0 @@ -TEST [[ -do - x = 1 -end -]] - -TEST [[ -return nil, 1, true, 'xx' -]] - -TEST [[ -return a -]] - -TEST [[ -retrun a.b:c(1, 2, ...)[1][name] -]] - -TEST [[ -return 1 + 1 -]] - -TEST [[ -return -1 -]] - -TEST [[ -return ... -]] - -TEST [[ -return function (a, b, ...) -end -]] - -TEST [[ -return { - a = 1, - b = { - c = d, - e = f, - }, - g, - h, - 1, -} -]] - -TEST [[ -::LABEL:: -goto LABEL -goto NEXT -::NEXT:: -]] - -TEST [[ -a, b, c = 1, 2, ... -]] - -TEST [[ -local a, b, c = 1, 2, ... -]] - -TEST [[ -a[#a+1] = 1 -]] - -TEST [[ -xx(a, b, 2, 3, ...) -]] - -TEST [[ -if a then -elseif b then -elseif c then -else -end -]] - -TEST [[ -for i = 1, 10, 1 do -end -]] - -TEST [[ -for a, b, c in pairs(t) do -end -]] - -TEST [[ -while true do -end -]] - -TEST [[ -repeat -until true -]] - -TEST [[ -function xx:yy(a, b, c, ...) -end -]] - -TEST [[ -local function xx(a, b, c, ...) -end -]] - -TEST [[ -local v = 1 -local function xx() - print(v) -end -local v = 2 -xx() -]] - -TEST [[ -return { - 1, 2, 3 -} -]] - -TEST [[ -return function () -end -]] |