diff options
Diffstat (limited to 'server/test/definition')
-rw-r--r-- | server/test/definition/arg.lua | 1 | ||||
-rw-r--r-- | server/test/definition/init.lua | 3 | ||||
-rw-r--r-- | server/test/definition/method.lua | 50 |
3 files changed, 26 insertions, 28 deletions
diff --git a/server/test/definition/arg.lua b/server/test/definition/arg.lua index 3d92da9a..9e88b2bf 100644 --- a/server/test/definition/arg.lua +++ b/server/test/definition/arg.lua @@ -9,6 +9,7 @@ local <!mt!> function mt:x() <?self?>() end +mt:x() ]] TEST [[ diff --git a/server/test/definition/init.lua b/server/test/definition/init.lua index d55457f6..19e353cc 100644 --- a/server/test/definition/init.lua +++ b/server/test/definition/init.lua @@ -1,5 +1,6 @@ local core = require 'core' local parser = require 'parser' +local buildVM = require 'vm' rawset(_G, 'TEST', true) @@ -41,7 +42,7 @@ function TEST(script) local new_script = script:gsub('<[!?]', ' '):gsub('[!?]>', ' ') local ast = parser:ast(new_script) assert(ast) - local vm = core.vm(ast) + local vm = buildVM(ast) assert(vm) local result = core.findResult(vm, pos) diff --git a/server/test/definition/method.lua b/server/test/definition/method.lua index 7db4b56d..40c5f127 100644 --- a/server/test/definition/method.lua +++ b/server/test/definition/method.lua @@ -112,30 +112,26 @@ local obj = sm({}, mt) obj:<?method1?>() ]] --- TODO 更换 meta__index 的实现 --- 表和__index之间不共享child --- 编译完成后进行后处理,如果某个field只有读取操作,则将值链接到meta表中 - ---TEST [[ ---local mt = {} ---function mt:<!x!>() ---end --- ---local obj = setmetatable({}, {__index = mt}) ---function obj:x() ---end --- ---mt:<?x?>() ---]] --- ---TEST [[ ---local mt = {} ---function mt:x() ---end --- ---local obj = setmetatable({}, {__index = mt}) ---function obj:<!x!>() ---end --- ---obj:<?x?>() ---]] +TEST [[ +local mt = {} +function mt:<!x!>() +end + +local obj = setmetatable({}, {__index = mt}) +function obj:x() +end + +mt:<?x?>() +]] + +TEST [[ +local mt = {} +function mt:x() +end + +local obj = setmetatable({}, {__index = mt}) +function obj:<!x!>() +end + +obj:<?x?>() +]] |