aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/test/constructor_promotion_spec.yue
diff options
context:
space:
mode:
Diffstat (limited to 'spec/inputs/test/constructor_promotion_spec.yue')
-rw-r--r--spec/inputs/test/constructor_promotion_spec.yue26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/inputs/test/constructor_promotion_spec.yue b/spec/inputs/test/constructor_promotion_spec.yue
new file mode 100644
index 0000000..83c9d15
--- /dev/null
+++ b/spec/inputs/test/constructor_promotion_spec.yue
@@ -0,0 +1,26 @@
1describe "constructor promotion", ->
2 it "should promote simple arguments to assignment", ->
3 class Thing
4 new: (@name, @age) =>
5
6 instance = Thing "Alice", 30
7 assert.same instance.name, "Alice"
8 assert.same instance.age, 30
9
10 it "should promote multiple arguments", ->
11 class Point
12 new: (@x, @y, @z) =>
13
14 p = Point 1, 2, 3
15 assert.same p.x, 1
16 assert.same p.y, 2
17 assert.same p.z, 3
18
19 it "should work with multiple parameters", ->
20 class Container
21 new: (@a, @b, @c) =>
22
23 c = Container!
24 assert.same c.a, nil
25 assert.same c.b, nil
26 assert.same c.c, nil