summaryrefslogtreecommitdiff
path: root/vm0/vm_test.go
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2023-07-10 15:54:13 +0200
committerMarc Vertes <mvertes@free.fr>2023-07-10 15:54:13 +0200
commit80c277773a1e73267832641574654361b85e6028 (patch)
treec39b422716e41e47987b62cdc4a9dd2649cc2138 /vm0/vm_test.go
first commit
Diffstat (limited to 'vm0/vm_test.go')
-rw-r--r--vm0/vm_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/vm0/vm_test.go b/vm0/vm_test.go
new file mode 100644
index 0000000..0e8896b
--- /dev/null
+++ b/vm0/vm_test.go
@@ -0,0 +1,26 @@
+package vm0
+
+import (
+ "os"
+ "testing"
+
+ "github.com/gnolang/parscan/lang/golang"
+)
+
+func TestEval(t *testing.T) {
+ i := New(golang.GoParser)
+ t.Logf("%#v\n", i.Parser)
+ //i.Eval("println(2*5)")
+ //n, _ := i.Parse("println(2*5)")
+ //n, _ := i.Parse(`a := 2 + 5`)
+ src := `a := 2`
+ nodes, err := i.Parse(src)
+ if err != nil {
+ t.Errorf("error %v", err)
+ }
+ i.Adot(nodes, os.Getenv("DOT"))
+ for _, n := range nodes {
+ v, err := i.Run(n, "")
+ t.Log(v, err)
+ }
+}