/* Unit Test: IO Operations */ /* Tests: ..out, ..assert, ..listen, ..emit operations */ /* Test basic output */ ..out "Testing IO operations"; /* Test assertions */ x : 5; y : 3; sum : x + y; ..assert x = 5; ..assert y = 3; ..assert sum = 8; ..assert x > 3; ..assert y < 10; ..assert sum != 0; /* Test string comparisons */ ..assert "hello" = "hello"; ..assert "world" != "hello"; /* Test complex assertions */ ..assert (x + y) = 8; ..assert (x * y) = 15; ..assert (x > y) = true; /* Test ..listen functionality */ state : ..listen; ..assert state.status = "placeholder"; ..assert state.message = "State not available in standalone mode"; /* Test ..listen in when expression */ result : when ..listen is { status: "placeholder" } then "Placeholder detected" { status: "active" } then "Active state detected" _ then "Unknown state"; ..assert result = "Placeholder detected"; /* Test ..emit with different data types */ ..emit "String value"; ..emit 42; ..emit true; ..emit { key: "value", number: 123 }; /* Test ..emit with computed expressions */ computed_table : { a: 10, b: 20 }; computed_sum : computed_table.a + computed_table.b; ..emit computed_sum; /* Test ..emit with conditional logic */ condition : 10 > 5; message : when condition is true then "Condition is true" false then "Condition is false"; ..emit message; /* Test that ..emit doesn't interfere with ..out */ ..out "This should appear via ..out"; ..emit "This should appear via ..emit"; ..out "Another ..out message"; ..out "IO operations test completed";