From 5692837175bb9bfd9b0b8be7caa39b0117948cbb Mon Sep 17 00:00:00 2001 From: James Shubin Date: Mon, 4 Aug 2025 20:37:18 -0400 Subject: [PATCH] lang: Add a simple test of a non-tree dag --- lang/interpret_test/TestAstFunc1/shape9.txtar | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lang/interpret_test/TestAstFunc1/shape9.txtar diff --git a/lang/interpret_test/TestAstFunc1/shape9.txtar b/lang/interpret_test/TestAstFunc1/shape9.txtar new file mode 100644 index 00000000..fb2b88d7 --- /dev/null +++ b/lang/interpret_test/TestAstFunc1/shape9.txtar @@ -0,0 +1,28 @@ +-- main.mcl -- +# This code produces a DAG which is not a tree. +$x = "hi" + +func foo($a) { + $a + $x + "there" +} + +$out = foo($x) + $x + +test "${out}" {} +-- OUTPUT -- +Edge: _operator -> _operator # a +Edge: _operator -> _operator # a +Edge: const: str("+") -> _operator # op +Edge: const: str("+") -> _operator # op +Edge: const: str("+") -> _operator # op +Edge: const: str("hi") -> _operator # a, b +Edge: const: str("hi") -> _operator # b +Edge: const: str("there") -> _operator # b +Vertex: _operator +Vertex: _operator +Vertex: _operator +Vertex: const: str("+") +Vertex: const: str("+") +Vertex: const: str("+") +Vertex: const: str("hi") +Vertex: const: str("there")