summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-04-19 16:38:39 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-04-19 16:38:39 +0800
commitc0c9004319cfda87fefbb34cffa5207a3ed81ee0 (patch)
treebc1e0fa758fc69787c8af600284e1c26eff1d568 /test
parent3c6f6a95ed5962bc8fe508ff39a207d542a6cfa1 (diff)
downloadlua-language-server-c0c9004319cfda87fefbb34cffa5207a3ed81ee0.zip
stash
Diffstat (limited to 'test')
-rw-r--r--test/basic/linker.txt56
1 files changed, 44 insertions, 12 deletions
diff --git a/test/basic/linker.txt b/test/basic/linker.txt
index 18176369..49f27234 100644
--- a/test/basic/linker.txt
+++ b/test/basic/linker.txt
@@ -1,16 +1,48 @@
ast -> linkers = {
- globals = {
- ['"X"|"Y"|"Z"'] = {src1, src2, src3},
- ['"X"|"Y"'] = {src4, src5, src6},
- ['"X"'] = {src7, src8, src9},
- },
- locals = {
- ['7'] = {src10},
- ['7|"x"'] = {src11},
- },
- tfield = {
- ['11|"k"'] = {src12},
- },
+ ['g|"X"|"Y"|"Z"'] = {src1, src2, src3},
+ ['g|"X"|"Y"'] = {src4, src5, src6},
+ ['g|"X"'] = {src7, src8, src9},
+ ['l|7'] = {src10},
+ ['l|7|"x"'] = {src11},
+ ['l|11|"k"'] = {src12},
}
+```lua
+x.y.<?z?> = <!f!>
+<?g?> = x.y.z
+
+t.<!z!> = 1
+x.y = t
+
+x = {
+ y = {
+ <!z!> = 1
+ }
+}
+```
+
+expect: 'l|x|y|z'
+forward: 'l|x|y|z' -> f
+backward: 'l|x|y|z' -> g
+last: 'l|x|y' + 'z'
+
+expect: 'l|x|y' + '|z'
+forward: 'l|t' + '|z' -> 'l|t|z' -> t.z
+backward: nil
+last: 'l|x' + '|y|z'
+
+expect: 'l|x' + '|y|z'
+forward: 'l|0' + '|y|z' -> 'l|0|y|z'
+backward: nil
+last: nil
+
+expect: 'l|0|y|z'
+forward: nil
+backward: nil
+last: 'l|0|y' + '|z'
+
+expect: 'l|0|y' + '|z'
+forward: 'l|1'+ '|z' -> 'l|1|z' -> field z
+backward: nil
+last: 'l|0' + '|y|z'