diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-11-20 18:40:33 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-11-20 18:40:33 +0800 |
commit | 67f6a20b27c98788843883c3712c648e110d781f (patch) | |
tree | 209705e0bc3c2c44d5ffade78cc2c7041eeffdda /test/implementation | |
parent | a65a1ddb13854c2dfde4c04630a0a942abdafa32 (diff) | |
download | lua-language-server-67f6a20b27c98788843883c3712c648e110d781f.zip |
转移目录
Diffstat (limited to 'test/implementation')
-rw-r--r-- | test/implementation/arg.lua | 23 | ||||
-rw-r--r-- | test/implementation/bug.lua | 15 | ||||
-rw-r--r-- | test/implementation/function.lua | 24 | ||||
-rw-r--r-- | test/implementation/if.lua | 106 | ||||
-rw-r--r-- | test/implementation/init.lua | 57 | ||||
-rw-r--r-- | test/implementation/local.lua | 191 | ||||
-rw-r--r-- | test/implementation/set.lua | 31 | ||||
-rw-r--r-- | test/implementation/table.lua | 6 |
8 files changed, 0 insertions, 453 deletions
diff --git a/test/implementation/arg.lua b/test/implementation/arg.lua deleted file mode 100644 index 2004d666..00000000 --- a/test/implementation/arg.lua +++ /dev/null @@ -1,23 +0,0 @@ -TEST [[ -local function xx (<!xx!>) - <?xx?> = 1 -end -]] - -TEST [[ -local function x (x, <!...!>) - x = <?...?> -end -]] - -TEST [[ -function mt<!:!>x() - <?self?> = 1 -end -]] - -TEST [[ -function mt:x(<!self!>) - <?self?> = 1 -end -]] diff --git a/test/implementation/bug.lua b/test/implementation/bug.lua deleted file mode 100644 index b0e890ca..00000000 --- a/test/implementation/bug.lua +++ /dev/null @@ -1,15 +0,0 @@ -TEST [[ -local <!x!> -function _(x) -end -function _() - <?x?> -end -]] - -TEST [[ -function _(<!x!>) - do return end - <?x?> = 1 -end -]] diff --git a/test/implementation/function.lua b/test/implementation/function.lua deleted file mode 100644 index 90b75da8..00000000 --- a/test/implementation/function.lua +++ /dev/null @@ -1,24 +0,0 @@ - -TEST [[ -function <!x!> () end -<?x?> = 1 -]] - -TEST [[ -local function <!x!> () end -<?x?> = 1 -]] - -TEST [[ -local x -local function <!x!> () - <?x?> = 1 -end -]] - -TEST [[ -local x -function <!x!>() -end -<?x?> = 1 -]] diff --git a/test/implementation/if.lua b/test/implementation/if.lua deleted file mode 100644 index 0da8be1a..00000000 --- a/test/implementation/if.lua +++ /dev/null @@ -1,106 +0,0 @@ -TEST [[ -<!x!> = 1 -if 1 then - x = 1 -else - <?x?> = 1 -end -]] - -TEST [[ -<!x!> = 1 -if 1 then - <!x!> = 1 -else - <!x!> = 1 -end -<?x?> = 1 -]] - -TEST [[ -<!x!> = 1 -if 1 then - <!x!> = 1 -elseif 1 then - <!x!> = 1 -else - <!x!> = 1 -end -<?x?> = 1 -]] - -TEST [[ -<!x!> = 1 -if 1 then - <!x!> = 1 -elseif 1 then - <!x!> = 1 - if 1 then - <!x!> = 1 - end -else - <!x!> = 1 -end -<?x?> = 1 -]] - -TEST [[ -<!x!> = 1 -while true do - <!x!> = 1 -end -<?x?> = 1 -]] - -TEST [[ -<!x!> = 1 -for _ in _ do - <!x!> = 1 -end -<?x?> = 1 -]] - -TEST [[ -<!x!> = 1 -for _ = 1, 1 do - <!x!> = 1 -end -<?x?> = 1 -]] - -TEST [[ -x3 = 1 -repeat - <!x3!> = 1 -until <?x3?> == 1 -]] - -TEST [[ -<!x!> = 1 -repeat - <!x!> = 1 -until 1 -<?x?> = 1 -]] - -TEST [[ -<!x!> = 1 -while 1 do - x = 1 - <!x!> = 1 -end -<?x?> = 1 -]] - -TEST [[ -<!x!> = 1 -if 1 then - if 1 then - x = 1 - end -else - if 1 then - <?x?> = 1 - end -end -]] diff --git a/test/implementation/init.lua b/test/implementation/init.lua deleted file mode 100644 index de8d9d63..00000000 --- a/test/implementation/init.lua +++ /dev/null @@ -1,57 +0,0 @@ -local matcher = require 'matcher' - -rawset(_G, 'TEST', true) - -local function catch_target(script) - local list = {} - local cur = 1 - while true do - local start, finish = script:find('<!.-!>', cur) - if not start then - break - end - list[#list+1] = { start + 2, finish - 2 } - cur = finish + 1 - end - return list -end - -local function founded(targets, results) - while true do - local target = table.remove(targets) - if not target then - break - end - for i, result in ipairs(results) do - if target[1] == result[1] and target[2] == result[2] then - table.remove(results, i) - goto CONTINUE - end - end - do return false end - ::CONTINUE:: - end - if #results == 0 then - return true - else - return false - end -end - -function TEST(script) - local target = catch_target(script) - local pos = script:find('<?', 1, true) + 2 - local new_script = script:gsub('<[!?]', ' '):gsub('[!?]>', ' ') - - local suc, result = matcher.implementation(new_script, pos) - assert(suc) - assert(founded(target, result)) -end - -require 'implementation.set' -require 'implementation.local' -require 'implementation.arg' -require 'implementation.function' -require 'implementation.if' ---require 'implementation.table' -require 'implementation.bug' diff --git a/test/implementation/local.lua b/test/implementation/local.lua deleted file mode 100644 index 7e9b3db0..00000000 --- a/test/implementation/local.lua +++ /dev/null @@ -1,191 +0,0 @@ -TEST [[ -local <!x!> -<?x?> = 1 -]] - -TEST [[ -local z, y, <!x!> -<?x?> = 1 -]] - -TEST [[ -local <!x!> = 1 -<?x?> = 1 -]] - -TEST [[ -local z, y, <!x!> = 1 -<?x?> = 1 -]] - -TEST [[ -local x -local <!x!> -<?x?> = 1 -]] - -TEST [[ -local <!x!> -do - <?x?> = 1 -end -]] - -TEST [[ -local <!x!> -do - local x -end -<?x?> = 1 -]] - -TEST [[ -local <!x!> -if <?x?> then - local x -end -]] - -TEST [[ -local <!x2!> -if x2 then - local x2 -elseif <?x2?> then - local x2 -end -]] - -TEST [[ -local <!x!> -if x then - local x -elseif x then - local x -else - local x -end -<?x?> = 1 -]] - -TEST [[ -local <!x!> -if x then - <?x?> = 1 -elseif x then - local x -else - local x -end -]] - -TEST [[ -local <!x!> -for x = 1, 10 do -end -<?x?> = 1 -]] - -TEST [[ -local x -for <!x!> = 1, 10 do - <?x?> = 1 -end -]] - -TEST [[ -local <!x!> -for x in x do -end -<?x?> = 1 -]] - -TEST [[ -local <!x!> -for x in <?x?> do -end -]] - -TEST [[ -local x -for <!x!> in x do - <?x?> = 1 -end -]] - -TEST [[ -local x -for z, y, <!x!> in x do - <?x?> = 1 -end -]] - -TEST [[ -local <!x!> -while <?x?> do -end -]] - -TEST [[ -local <!x!> -while x do - <?x?> = 1 -end -]] - -TEST [[ -local <!x!> -while x do - local x -end -<?x?> = 1 -]] - -TEST [[ -local <!x!> -repeat - <?x?> = 1 -until true -]] - -TEST [[ -local <!x!> -repeat - local x -until true -<?x?> = 1 -]] - -TEST [[ -local <!x!> -repeat -until <?x?> -]] - -TEST [[ -local x -repeat - local <!x!> -until <?x?> -]] - -TEST [[ -local <!x!> -function _() - local x -end -<?x?> = 1 -]] - -TEST [[ -local <!x!> -return function () - <?x?> = 1 -end -]] - -TEST [[ -local <!x!> -local x = function () - <?x?> = 1 -end -]] diff --git a/test/implementation/set.lua b/test/implementation/set.lua deleted file mode 100644 index 5c4a1a2e..00000000 --- a/test/implementation/set.lua +++ /dev/null @@ -1,31 +0,0 @@ -TEST [[ -<!x!> = 1 -<?x?> = 1 -]] - -TEST [[ -global = 1 -do - <!global!> = 2 -end -<?global?> = 3 -]] - -TEST [[ -<!x!> = 1 -do - local x = 1 -end -<?x?> = 1 -]] - -TEST [[ -x = 1 -do - local x = 1 - do - <!x!> = 2 - end - <?x?> = 1 -end -]] diff --git a/test/implementation/table.lua b/test/implementation/table.lua deleted file mode 100644 index 13a3b555..00000000 --- a/test/implementation/table.lua +++ /dev/null @@ -1,6 +0,0 @@ -TEST [[ -local t = { - <!x!> = 1, -} -t.<?x?> = 1 -]] |