From dd64edd58fe25ec74ae5958128cf3f74b0692f3b Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 28 Jan 2026 18:43:14 +0800 Subject: Fixed compiler issues and added 800+ test cases. --- spec/inputs/test/in_expression_spec.yue | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'spec/inputs/test/in_expression_spec.yue') diff --git a/spec/inputs/test/in_expression_spec.yue b/spec/inputs/test/in_expression_spec.yue index c1f4099..d9e3aec 100644 --- a/spec/inputs/test/in_expression_spec.yue +++ b/spec/inputs/test/in_expression_spec.yue @@ -9,11 +9,11 @@ describe "in expression", -> assert.is_true "b" in chars assert.is_false "z" in chars - it "should check keys in table", -> - obj = {x: 1, y: 2, z: 3} - assert.is_true "x" in obj - assert.is_true "y" in obj - assert.is_false "w" in obj + it "should check in table literal", -> + x = 1; y = 2; z = 3; w = 4 + assert.is_true x in [x, y, z] + assert.is_true y in [x, y, z] + assert.is_false w in [x, y, z] it "should work with mixed types", -> items = {1, "two", true, nil} @@ -41,7 +41,8 @@ describe "in expression", -> assert.is_false not (2 in items) it "should work with nested tables", -> - nested = {{1, 2}, {3, 4}, {5, 6}} + eq = (other) => @[1] == other[1] and @[2] == other[2] + nested = {{1, 2, :}, {3, 4, :}, {5, 6, :}} assert.is_true {1, 2} in nested assert.is_false {1, 3} in nested @@ -60,7 +61,7 @@ describe "in expression", -> it "should support table as value", -> key1 = {a: 1} key2 = {b: 2} - tb = {[key1]: "first", [key2]: "second"} + tb = [key1, key2] -- Note: this tests table reference equality assert.is_true key1 in tb @@ -77,7 +78,7 @@ describe "in expression", -> assert.is_true 1 in items it "should work with string keys", -> - obj = {name: "test", value: 42} + obj = ["name", "value"] assert.is_true "name" in obj assert.is_true "value" in obj assert.is_false "missing" in obj -- cgit v1.2.3-55-g6feb