From 81fb889cbf994be47f162dbfda446f80e51c6fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sat, 16 Nov 2019 03:02:01 +0800 Subject: =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=AB=98=E4=BA=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/test/highlight/init.lua | 99 ++++++++++++++++++++++++++++--------- 1 file changed, 76 insertions(+), 23 deletions(-) (limited to 'server-beta/test/highlight') diff --git a/server-beta/test/highlight/init.lua b/server-beta/test/highlight/init.lua index 6298fc2e..fbde194b 100644 --- a/server-beta/test/highlight/init.lua +++ b/server-beta/test/highlight/init.lua @@ -35,58 +35,111 @@ local function founded(targets, results) end function TEST(script) - files.removeAll() local target = catch_target(script) - local start = script:find('', 1, true) - local pos = (start + finish) // 2 + 1 - local new_script = script:gsub('<[!?]', ' '):gsub('[!?]>', ' ') - files.setText('', new_script) - - local positions = core('', pos) - if positions then - assert(founded(target, positions)) - else - assert(#target == 0) + for _, enter in ipairs(target) do + local start, finish = enter.start, enter.finish + files.removeAll() + local pos = (start + finish) // 2 + 1 + local new_script = script:gsub('<[!?~]', ' '):gsub('[!?~]>', ' ') + files.setText('', new_script) + + local positions = core('', pos) + if positions then + assert(founded(target, positions)) + else + assert(#target == 0) + end end end TEST [[ -local = 1 +local = 1 ]] TEST [[ -local = 1 +local = 1 = 2 = ]] TEST [[ -t. = 1 +t. = 1 a = t. ]] TEST [[ t[] = 1 -a = t. -]] - -TEST [[ -t[] = 1 a = t. ]] TEST [[ -:: :: +:: :: goto ]] TEST [[ local function f() - return + return end ]] TEST [[ -local s = +local s = +]] + +TEST [[ +local b = +]] + +TEST [[ +local n = +]] + +TEST [[ +local n = +]] + +TEST [[ +local f () +]] + +TEST [[ + f () +]] + +TEST [[ +return () +]] + +TEST [[ + true + true + true + + +]] + +TEST [[ + _ _ + +]] + +TEST [[ + i = 1, 10 + +]] + +TEST [[ + true + +]] + +TEST [[ + + true +]] + +TEST [[ + + ]] -- cgit v1.2.3