about summary refs log tree commit diff stats
path: root/js/scripting-lang/tests/05_io_operations.txt
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/tests/05_io_operations.txt')
-rw-r--r--js/scripting-lang/tests/05_io_operations.txt37
1 files changed, 36 insertions, 1 deletions
diff --git a/js/scripting-lang/tests/05_io_operations.txt b/js/scripting-lang/tests/05_io_operations.txt
index a16bf94..6d05dfe 100644
--- a/js/scripting-lang/tests/05_io_operations.txt
+++ b/js/scripting-lang/tests/05_io_operations.txt
@@ -1,5 +1,5 @@
 /* Unit Test: IO Operations */
-/* Tests: ..out, ..assert operations */
+/* Tests: ..out, ..assert, ..listen, ..emit operations */
 
 /* Test basic output */
 ..out "Testing IO operations";
@@ -25,4 +25,39 @@ sum : x + y;
 ..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"; 
\ No newline at end of file