From 8b0d3827faf0cdc967e52ddfbe043c07c0dbe6a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 16 Dec 2021 17:07:15 +0800 Subject: #847 normalize `./` --- script/workspace/workspace.lua | 1 + test/crossfile/definition.lua | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index ea2c4737..529c8936 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -488,6 +488,7 @@ function m.normalize(path) end end) path = util.expandPath(path) + path = path:gsub('^%.[/\\]+', '') if platform.OS == 'Windows' then path = path:gsub('[/\\]+', '\\') :gsub('[/\\]+$', '') diff --git a/test/crossfile/definition.lua b/test/crossfile/definition.lua index 058f5d18..b0cc232f 100644 --- a/test/crossfile/definition.lua +++ b/test/crossfile/definition.lua @@ -867,3 +867,28 @@ print(t.) ]] } } + +local originRuntimePath = config.get 'Lua.runtime.path' +config.set('Lua.runtime.path', { + './?.lua' +}) + +TEST { + { + path = 'a.lua', + content = [[ +return { + = 1, +} +]], + }, + { + path = 'b.lua', + content = [[ +local t = require 'a' +print(t.) + ]] + } +} + +config.set('Lua.runtime.path', originRuntimePath) -- cgit v1.2.3