Files
mgmt/lang/interpret_test/TestAstFunc1/doubleclass.txtar
James Shubin 8d63b98212 lang: Add a bunch of new language tests
These test both graph shape consistency and single value outputs.
Eventually we want to make the graph shape tests more precise, and also
verify specific outputs how it used to be. For now, this is okay.

Co-authored-by: Samuel Gélineau <gelisam@gmail.com>
2023-09-25 18:50:43 -04:00

66 lines
1.3 KiB
Plaintext

-- main.mcl --
import "fmt"
# this value should only be built once
$some_value1 = 42 # or something more complex like the output of a slow function...
class foo($num) {
# we should have a different `$inside` value for each use of this class
$inside = $some_value1 + $some_value2 + 4
test fmt.printf("test-%d-%d", $num, $inside) {} # some resource
}
$some_value2 = 13 # check that non-ordering works too!
# We *don't* unnecessarily copy `4` on each include, because it's static!
include foo(1)
include foo(2)
include foo(3)
-- OUTPUT --
Edge: FuncValue -> call # fn
Edge: FuncValue -> call # fn
Edge: FuncValue -> call # fn
Edge: FuncValue -> call # fn
Edge: FuncValue -> call # fn
Edge: FuncValue -> call # fn
Edge: FuncValue -> call # fn
Edge: FuncValue -> call # fn
Edge: FuncValue -> call # fn
Vertex: FuncValue
Vertex: FuncValue
Vertex: FuncValue
Vertex: FuncValue
Vertex: FuncValue
Vertex: FuncValue
Vertex: FuncValue
Vertex: FuncValue
Vertex: FuncValue
Vertex: call
Vertex: call
Vertex: call
Vertex: call
Vertex: call
Vertex: call
Vertex: call
Vertex: call
Vertex: call
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const
Vertex: const