aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/test/tables_advanced_spec.yue
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2026-01-28 18:43:14 +0800
committerLi Jin <dragon-fly@qq.com>2026-01-28 18:43:14 +0800
commitdd64edd58fe25ec74ae5958128cf3f74b0692f3b (patch)
tree0f2de1df55897e2713977c5a53936757e14b477a /spec/inputs/test/tables_advanced_spec.yue
parent7c2a92b82e9808d3c5ea29b47d1c59d663fe984a (diff)
downloadyuescript-dd64edd58fe25ec74ae5958128cf3f74b0692f3b.tar.gz
yuescript-dd64edd58fe25ec74ae5958128cf3f74b0692f3b.tar.bz2
yuescript-dd64edd58fe25ec74ae5958128cf3f74b0692f3b.zip
Fixed compiler issues and added 800+ test cases.
Diffstat (limited to 'spec/inputs/test/tables_advanced_spec.yue')
-rw-r--r--spec/inputs/test/tables_advanced_spec.yue13
1 files changed, 7 insertions, 6 deletions
diff --git a/spec/inputs/test/tables_advanced_spec.yue b/spec/inputs/test/tables_advanced_spec.yue
index c8cc7d5..82f4d4e 100644
--- a/spec/inputs/test/tables_advanced_spec.yue
+++ b/spec/inputs/test/tables_advanced_spec.yue
@@ -35,8 +35,9 @@ describe "advanced tables", ->
35 assert.same tb[4], 4 35 assert.same tb[4], 4
36 36
37 it "should work with single line table literals", -> 37 it "should work with single line table literals", ->
38 my_function dance: "Tango", partner: "none" 38 tb = dance: "Tango", partner: "none"
39 assert.is_true true 39 assert.same tb.dance, "Tango"
40 assert.same tb.partner, "none"
40 41
41 it "should support nested tables", -> 42 it "should support nested tables", ->
42 tb = 43 tb =
@@ -90,10 +91,9 @@ describe "advanced tables", ->
90 assert.same merge.y, 1 91 assert.same merge.y, 1
91 92
92 it "should handle mixed spread", -> 93 it "should handle mixed spread", ->
93 parts = { 94 parts =
94 * "shoulders" 95 * "shoulders"
95 * "knees" 96 * "knees"
96 }
97 lyrics = 97 lyrics =
98 * "head" 98 * "head"
99 * ...parts 99 * ...parts
@@ -108,7 +108,7 @@ describe "advanced tables", ->
108 108
109 a = <>: mt, value: 1 109 a = <>: mt, value: 1
110 b = value: 2 110 b = value: 2
111 b.<>, mt 111 b.<> = mt
112 c = a + b 112 c = a + b
113 assert.same c.value, 3 113 assert.same c.value, 3
114 114
@@ -121,11 +121,12 @@ describe "advanced tables", ->
121 tb = { 121 tb = {
122 item: "test" 122 item: "test"
123 new: -> "created" 123 new: -> "created"
124 close: -> "closed" 124 <close>: -> "closed"
125 } 125 }
126 {:item, :new, :<close>} = tb 126 {:item, :new, :<close>} = tb
127 assert.same item, "test" 127 assert.same item, "test"
128 assert.same new!, "created" 128 assert.same new!, "created"
129 assert.same close!, "closed"
129 130
130 it "should work with string keys directly", -> 131 it "should work with string keys directly", ->
131 t = { 132 t = {