diff options
Diffstat (limited to 'spec/inputs/in_expression.yue')
-rw-r--r-- | spec/inputs/in_expression.yue | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/spec/inputs/in_expression.yue b/spec/inputs/in_expression.yue index 6e923e1..6faff4e 100644 --- a/spec/inputs/in_expression.yue +++ b/spec/inputs/in_expression.yue | |||
@@ -1,28 +1,13 @@ | |||
1 | -a^2 in {1, 2, 3} |> f | 1 | -a^2 in {1, 2, 3} |> f |
2 | 2 | -a^2 in [1, 2, 3] |> f | |
3 | a, b = x(...) not in [1, 3], 2 | ||
4 | |||
5 | d = (tb.x.y ...) not in [1, 3] | ||
6 | 3 | ||
7 | has = "foo" in { "bar", "foo" } | 4 | has = "foo" in { "bar", "foo" } |
8 | 5 | ||
9 | if a in {1} and b in {2, 3, 4} or c in [1, 10] | 6 | if a in {1} and b in {2, 3, 4} |
10 | print a, b, c | 7 | print a, b, c |
11 | 8 | ||
12 | switch val | 9 | if a in [1,] and b in [2, 3, 4] |
13 | when 1, 2, 3 | 10 | print a, b, c |
14 | print "1, 2, 3" | ||
15 | |||
16 | when not in (0, 100] | ||
17 | print "not (0 < val <= 100)" | ||
18 | |||
19 | when in [200, 300) | ||
20 | print "200 <= val < 300)" | ||
21 | |||
22 | when not in {333, 444, 555} | ||
23 | print "not 333, 444 or 555" | ||
24 | |||
25 | do return y not in (a, b) | ||
26 | 11 | ||
27 | do | 12 | do |
28 | exist = item in list | 13 | exist = item in list |
@@ -36,9 +21,11 @@ do | |||
36 | do | 21 | do |
37 | item = get! | 22 | item = get! |
38 | list = {1, 2, 3} | 23 | list = {1, 2, 3} |
24 | list = [1, 2, 3] | ||
39 | not_exist = item not in list | 25 | not_exist = item not in list |
40 | check item in list | 26 | check item in list |
41 | check item in {1, 2, 3} | 27 | check item in {1, 2, 3} |
28 | check item in [1, 2, 3] | ||
42 | check item(...) in {[1]: 1, [2]: 2, [3]: 3} | 29 | check item(...) in {[1]: 1, [2]: 2, [3]: 3} |
43 | 30 | ||
44 | do | 31 | do |