aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/with.moon
diff options
context:
space:
mode:
Diffstat (limited to 'spec/inputs/with.moon')
-rw-r--r--spec/inputs/with.moon136
1 files changed, 68 insertions, 68 deletions
diff --git a/spec/inputs/with.moon b/spec/inputs/with.moon
index f543356..704c494 100644
--- a/spec/inputs/with.moon
+++ b/spec/inputs/with.moon
@@ -1,118 +1,118 @@
1 1
2do 2do
3 a = -> 3 a = ->
4 with something 4 with something
5 print .hello 5 print .hello
6 print hi 6 print hi
7 print "world" 7 print "world"
8 8
9do 9do
10 with leaf 10 with leaf
11 .world! 11 .world!
12 .world 1,2,3 12 .world 1,2,3
13 13
14 g = .what.is.this 14 g = .what.is.this
15 15
16 .hi 1,2,3 16 .hi 1,2,3
17 17
18 \hi(1,2).world 2323 18 \hi(1,2).world 2323
19 19
20 \hi "yeah", "man" 20 \hi "yeah", "man"
21 .world = 200 21 .world = 200
22 22
23do 23do
24 zyzyzy = with something 24 zyzyzy = with something
25 .set_state "hello world" 25 .set_state "hello world"
26 26
27do 27do
28 x = 5 + with Something! 28 x = 5 + with Something!
29 \write "hello world" 29 \write "hello world"
30 30
31 31
32do 32do
33 x = { 33 x = {
34 hello: with yeah 34 hello: with yeah
35 \okay! 35 \okay!
36 } 36 }
37 37
38do 38do
39 with foo 39 with foo
40 _ = \prop"something".hello 40 _ = \prop"something".hello
41 .prop\send(one) 41 .prop\send(one)
42 .prop\send one 42 .prop\send one
43 43
44 44
45-- 45--
46 46
47do 47do
48 with a, b -- b is lost 48 with a, b -- b is lost
49 print .world 49 print .world
50 50
51 mod = with _M = {} 51 mod = with _M = {}
52 .Thing = "hi" 52 .Thing = "hi"
53 53
54 -- operate on a only 54 -- operate on a only
55 with a, b = something, pooh 55 with a, b = something, pooh
56 print .world 56 print .world
57 57
58 x = with a, b = 1, 2 58 x = with a, b = 1, 2
59 print a + b 59 print a + b
60 60
61 print with a, b = 1, 2 61 print with a, b = 1, 2
62 print a + b 62 print a + b
63 63
64 -- assignment lhs must be evaluated in the order they appear 64 -- assignment lhs must be evaluated in the order they appear
65 p = with hello!.x, world!.y = 1, 2 65 p = with hello!.x, world!.y = 1, 2
66 print a + b 66 print a + b
67 67
68-- 68--
69 69
70do 70do
71 x = "hello" 71 x = "hello"
72 with x 72 with x
73 x\upper! 73 x\upper!
74 74
75do 75do
76 with k = "jo" 76 with k = "jo"
77 print \upper! 77 print \upper!
78 78
79do 79do
80 with a,b,c = "", "", "" 80 with a,b,c = "", "", ""
81 print \upper! 81 print \upper!
82 82
83do 83do
84 a = "bunk" 84 a = "bunk"
85 with a,b,c = "", "", "" 85 with a,b,c = "", "", ""
86 print \upper! 86 print \upper!
87 87
88do 88do
89 with j 89 with j
90 print \upper! 90 print \upper!
91 91
92do 92do
93 with k.j = "jo" 93 with k.j = "jo"
94 print \upper! 94 print \upper!
95 95
96do 96do
97 with a 97 with a
98 print .b 98 print .b
99 -- nested `with`s should change the scope correctly 99 -- nested `with`s should change the scope correctly
100 with .c 100 with .c
101 print .d 101 print .d
102 102
103do 103do
104 with a 104 with a
105 -- nested `with`s with assignments should change the scope correctly 105 -- nested `with`s with assignments should change the scope correctly
106 with .b = 2 106 with .b = 2
107 print .c 107 print .c
108 108
109do 109do
110 _ = -> 110 _ = ->
111 with hi 111 with hi
112 return .a, .b 112 return .a, .b
113 113
114 114
115do 115do
116 with dad 116 with dad
117 .if "yes" 117 .if "yes"
118 y = .end.of.function 118 y = .end.of.function