diff options
author | Li Jin <dragon-fly@qq.com> | 2021-02-15 21:16:45 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-02-15 21:16:45 +0800 |
commit | 90cd12ad9ef465f3e435e1bd034dcfbe4e19d016 (patch) | |
tree | 27b6b6d48cb028b568af91a6d7e041e38743e3a0 | |
parent | c6e90a619d4bf027fa0c9fd81c71a6227b8cb3ca (diff) | |
download | yuescript-moonplus.tar.gz yuescript-moonplus.tar.bz2 yuescript-moonplus.zip |
adding more test cases.moonplus
-rw-r--r-- | spec/inputs/multiline_chain.mp | 67 | ||||
-rw-r--r-- | spec/inputs/syntax.mp | 15 |
2 files changed, 67 insertions, 15 deletions
diff --git a/spec/inputs/multiline_chain.mp b/spec/inputs/multiline_chain.mp new file mode 100644 index 0000000..e1e363f --- /dev/null +++ b/spec/inputs/multiline_chain.mp | |||
@@ -0,0 +1,67 @@ | |||
1 | x = a | ||
2 | .b | ||
3 | |||
4 | x | ||
5 | .y = a | ||
6 | \b! | ||
7 | |||
8 | func 1, arg2 | ||
9 | .value | ||
10 | \get!, arg3 | ||
11 | .value | ||
12 | \get! | ||
13 | |||
14 | result = origin | ||
15 | .transform.root | ||
16 | .gameObject | ||
17 | \Parents! | ||
18 | \Descendants! | ||
19 | \SelectEnable! | ||
20 | \SelectVisible! | ||
21 | \TagEqual "fx" | ||
22 | \Where (x)-> | ||
23 | if x\IsTargeted! | ||
24 | return false | ||
25 | x.name\EndsWith "(Clone)" | ||
26 | \Destroy! | ||
27 | |||
28 | origin.transform.root.gameObject | ||
29 | \Parents!\Descendants! | ||
30 | \SelectEnable! | ||
31 | \SelectVisible! | ||
32 | \TagEqual "fx" | ||
33 | \Where (x)-> x.name\EndsWith "(Clone)" | ||
34 | \Destroy! | ||
35 | |||
36 | with item() | ||
37 | .itemFieldA = 123 | ||
38 | item = x | ||
39 | |||
40 | \callMethod!\chainCall! | ||
41 | |||
42 | \callMethod! | ||
43 | \chainCall! | ||
44 | \chainCall! | ||
45 | |||
46 | switch .itemFieldB | ||
47 | \getValue! | ||
48 | when "Valid", \getItemState! | ||
49 | \itemMethodA!\getValue! | ||
50 | else | ||
51 | \itemMethodB! | ||
52 | \getValue! | ||
53 | |||
54 | a = if .itemFieldC | ||
55 | .itemFieldD | ||
56 | else | ||
57 | .itemFieldE | ||
58 | |||
59 | for v in *values | ||
60 | \itemMethodC v | ||
61 | |||
62 | unless .b | ||
63 | .c = while .itemFieldD | ||
64 | \itemNext! | ||
65 | \get! | ||
66 | |||
67 | nil | ||
diff --git a/spec/inputs/syntax.mp b/spec/inputs/syntax.mp index f3a0a5c..4df5785 100644 --- a/spec/inputs/syntax.mp +++ b/spec/inputs/syntax.mp | |||
@@ -123,21 +123,6 @@ argon\world().something() | |||
123 | 123 | ||
124 | argon\somethin"200".world(1,2) | 124 | argon\somethin"200".world(1,2) |
125 | 125 | ||
126 | origin | ||
127 | .transform | ||
128 | .root | ||
129 | .gameObject | ||
130 | \Parents! | ||
131 | \Descendants! | ||
132 | \SelectEnable! | ||
133 | \SelectVisible! | ||
134 | \TagEqual "fx" | ||
135 | \Where (x) -> | ||
136 | if x\IsTargeted! | ||
137 | return false | ||
138 | x.name\EndsWith "(Clone)" | ||
139 | \Destroy! | ||
140 | |||
141 | x = -434 | 126 | x = -434 |
142 | 127 | ||
143 | x = -hello world one two | 128 | x = -hello world one two |