From 864db86144b557e7d4eb8d96177d9642b4eff441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 14 Apr 2021 14:28:27 +0800 Subject: stash --- test/basic/linker.lua | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'test/basic') diff --git a/test/basic/linker.lua b/test/basic/linker.lua index 1ce3f726..bf4e50bb 100644 --- a/test/basic/linker.lua +++ b/test/basic/linker.lua @@ -2,7 +2,6 @@ local linker = require 'core.linker' local files = require 'files' local util = require 'utility' local guide = require 'core.guide' -local glob = require "glob" local function getSource(pos) local ast = files.getAst('') @@ -19,6 +18,7 @@ local function getSource(pos) end) end +local CARE = {} local function TEST(script) return function (expect) files.removeAll() @@ -30,10 +30,13 @@ local function TEST(script) local source = getSource(pos) assert(source) local result = linker.getLink(source) - assert(util.equal(result, expect)) + for key in pairs(CARE) do + assert(result[key] == expect[key]) + end end end +CARE['id'] = true TEST [[ local ]] { @@ -54,6 +57,7 @@ local x id = '7', } +CARE['global'] = true TEST [[ print() ]] { @@ -96,6 +100,7 @@ function x:() end global = true, } +CARE['tfield'] = true TEST [[ { = 1, @@ -105,10 +110,25 @@ TEST [[ tfield = true, } +CARE['freturn'] = true TEST [[ return ]] { id = '"X"', global = true, - freturn = true, + freturn = 0, } + +TEST [[ +function f() + return +end +]] { + id = '"X"', + global = true, + freturn = 1, +} + +TEST [[ + +]] -- cgit v1.2.3