diff --git a/lang/interpret_test.go b/lang/interpret_test.go index 8c9d6434..65f4bde2 100644 --- a/lang/interpret_test.go +++ b/lang/interpret_test.go @@ -24,6 +24,7 @@ import ( "fmt" "io/ioutil" "os" + "path/filepath" "sort" "strings" "testing" @@ -47,6 +48,7 @@ import ( "github.com/kylelemons/godebug/pretty" "github.com/spf13/afero" + "golang.org/x/tools/txtar" ) const ( @@ -1049,34 +1051,11 @@ func TestAstFunc2(t *testing.T) { Functions: ast.FuncPrefixToFunctionsScope(""), // runs funcs.LookupPrefix } - type errs struct { - failLexParse bool - failInit bool - failInterpolate bool - failSetScope bool - failUnify bool - failGraph bool - failInterpret bool - failAutoEdge bool - } type test struct { // an individual test name string - path string // relative sub directory path inside tests dir - fail bool - //graph *pgraph.Graph - expstr string // expected output graph in string format - errs errs + path string // relative txtar path inside tests dir } testCases := []test{} - //{ - // graph, _ := pgraph.NewGraph("g") - // testCases = append(testCases, test{ - // name: "simple hello world", - // path: "hello0/", - // fail: false, - // expstr: graph.Sprint(), - // }) - //} // build test array automatically from reading the dir files, err := ioutil.ReadDir(dir) @@ -1086,108 +1065,22 @@ func TestAstFunc2(t *testing.T) { } sorted := []string{} for _, f := range files { - if !f.IsDir() { + if f.IsDir() { continue } + if !strings.HasSuffix(f.Name(), ".txtar") { + continue + } + sorted = append(sorted, f.Name()) } sort.Strings(sorted) for _, f := range sorted { - graphFile := f + ".output" // expected output graph file - graphFileFull := dir + graphFile - info, err := os.Stat(graphFileFull) - if err != nil || info.IsDir() { - p := dir + f + "." + "T" + "O" + "D" + "O" - if _, err := os.Stat(p); err == nil { - // if it's a WIP, then don't error things - t.Logf("missing: %s", p) - continue - } - t.Errorf("missing: %s", graphFile) - t.Errorf("(err: %+v)", err) - continue - } - content, err := ioutil.ReadFile(graphFileFull) - if err != nil { - t.Errorf("could not read graph file: %+v", err) - return - } - str := string(content) // expected graph - - // if the graph file has a magic error string, it's a failure - errStr := "" - failLexParse := false - failInit := false - failInterpolate := false - failSetScope := false - failUnify := false - failGraph := false - failInterpret := false - failAutoEdge := false - if strings.HasPrefix(str, magicError) { - errStr = strings.TrimPrefix(str, magicError) - str = errStr - - if strings.HasPrefix(str, magicErrorLexParse) { - errStr = strings.TrimPrefix(str, magicErrorLexParse) - str = errStr - failLexParse = true - } - if strings.HasPrefix(str, magicErrorInit) { - errStr = strings.TrimPrefix(str, magicErrorInit) - str = errStr - failInit = true - } - if strings.HasPrefix(str, magicInterpolate) { - errStr = strings.TrimPrefix(str, magicInterpolate) - str = errStr - failInterpolate = true - } - if strings.HasPrefix(str, magicErrorSetScope) { - errStr = strings.TrimPrefix(str, magicErrorSetScope) - str = errStr - failSetScope = true - } - if strings.HasPrefix(str, magicErrorUnify) { - errStr = strings.TrimPrefix(str, magicErrorUnify) - str = errStr - failUnify = true - } - if strings.HasPrefix(str, magicErrorGraph) { - errStr = strings.TrimPrefix(str, magicErrorGraph) - str = errStr - failGraph = true - } - if strings.HasPrefix(str, magicErrorInterpret) { - errStr = strings.TrimPrefix(str, magicErrorInterpret) - str = errStr - failInterpret = true - } - if strings.HasPrefix(str, magicErrorAutoEdge) { - errStr = strings.TrimPrefix(str, magicErrorAutoEdge) - str = errStr - failAutoEdge = true - } - } - // add automatic test case testCases = append(testCases, test{ - name: fmt.Sprintf("dir: %s", f), - path: f + "/", - fail: errStr != "", - expstr: str, - errs: errs{ - failLexParse: failLexParse, - failInit: failInit, - failInterpolate: failInterpolate, - failSetScope: failSetScope, - failUnify: failUnify, - failGraph: failGraph, - failInterpret: failInterpret, - failAutoEdge: failAutoEdge, - }, + name: fmt.Sprintf("%s", f), + path: f, // .txtar }) - //t.Logf("adding: %s", f + "/") } if testing.Short() { @@ -1216,16 +1109,105 @@ func TestAstFunc2(t *testing.T) { continue } t.Run(testName, func(t *testing.T) { - name, path, fail, expstr, errs := tc.name, tc.path, tc.fail, strings.Trim(tc.expstr, "\n"), tc.errs - src := dir + path // location of the test - failLexParse := errs.failLexParse - failInit := errs.failInit - failInterpolate := errs.failInterpolate - failSetScope := errs.failSetScope - failUnify := errs.failUnify - failGraph := errs.failGraph - failInterpret := errs.failInterpret - failAutoEdge := errs.failAutoEdge + name, path := tc.name, tc.path + tmpdir := t.TempDir() // gets cleaned up at end, new dir for each call + src := tmpdir // location of the test + txtarFile := dir + path + + archive, err := txtar.ParseFile(txtarFile) + if err != nil { + t.Errorf("err parsing txtar(%s): %+v", txtarFile, err) + return + } + comment := strings.TrimSpace(string(archive.Comment)) + t.Logf("comment: %s\n", comment) + + // copy files out into the test temp directory + var testOutput []byte + found := false + for _, file := range archive.Files { + if file.Name == "OUTPUT" { + testOutput = file.Data + found = true + continue + } + + name := filepath.Join(tmpdir, file.Name) + dir := filepath.Dir(name) + if err := os.MkdirAll(dir, 0770); err != nil { + t.Errorf("err making dir(%s): %+v", dir, err) + return + } + if err := ioutil.WriteFile(name, file.Data, 0660); err != nil { + t.Errorf("err writing file(%s): %+v", name, err) + return + } + } + + if !found { // skip missing tests + return + } + + expstr := string(testOutput) // expected graph + + // if the graph file has a magic error string, it's a failure + errStr := "" + failLexParse := false + failInit := false + failInterpolate := false + failSetScope := false + failUnify := false + failGraph := false + failInterpret := false + failAutoEdge := false + if strings.HasPrefix(expstr, magicError) { + errStr = strings.TrimPrefix(expstr, magicError) + expstr = errStr + + if strings.HasPrefix(expstr, magicErrorLexParse) { + errStr = strings.TrimPrefix(expstr, magicErrorLexParse) + expstr = errStr + failLexParse = true + } + if strings.HasPrefix(expstr, magicErrorInit) { + errStr = strings.TrimPrefix(expstr, magicErrorInit) + expstr = errStr + failInit = true + } + if strings.HasPrefix(expstr, magicInterpolate) { + errStr = strings.TrimPrefix(expstr, magicInterpolate) + expstr = errStr + failInterpolate = true + } + if strings.HasPrefix(expstr, magicErrorSetScope) { + errStr = strings.TrimPrefix(expstr, magicErrorSetScope) + expstr = errStr + failSetScope = true + } + if strings.HasPrefix(expstr, magicErrorUnify) { + errStr = strings.TrimPrefix(expstr, magicErrorUnify) + expstr = errStr + failUnify = true + } + if strings.HasPrefix(expstr, magicErrorGraph) { + errStr = strings.TrimPrefix(expstr, magicErrorGraph) + expstr = errStr + failGraph = true + } + if strings.HasPrefix(expstr, magicErrorInterpret) { + errStr = strings.TrimPrefix(expstr, magicErrorInterpret) + expstr = errStr + failInterpret = true + } + if strings.HasPrefix(expstr, magicErrorAutoEdge) { + errStr = strings.TrimPrefix(expstr, magicErrorAutoEdge) + expstr = errStr + failAutoEdge = true + } + } + + fail := errStr != "" + expstr = strings.Trim(expstr, "\n") t.Logf("\n\ntest #%d (%s) ----------------\npath: %s\n\n", index, name, src) diff --git a/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda-args.output b/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda-args.output deleted file mode 100644 index 2fa831b7..00000000 --- a/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda-args.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[worldwide] diff --git a/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda-args/main.mcl b/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda-args.txtar similarity index 73% rename from lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda-args/main.mcl rename to lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda-args.txtar index e4f6f16e..25d2eb31 100644 --- a/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda-args/main.mcl +++ b/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda-args.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $some_bool = false $fn = if $some_bool { func($b) { @@ -11,3 +12,5 @@ $fn = if $some_bool { $out = $fn("wide") test $out {} +-- OUTPUT -- +Vertex: test[worldwide] diff --git a/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda.output b/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda.output deleted file mode 100644 index f7305817..00000000 --- a/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda.txtar similarity index 73% rename from lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda.txtar index 107268c1..e7dc2b66 100644 --- a/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/basic-conditional-scoped-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $some_bool = false $fn = if $some_bool { func($b) { @@ -11,3 +12,5 @@ $fn = if $some_bool { $out = $fn(false) test $out {} +-- OUTPUT -- +Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/chained-returned-funcs.output b/lang/interpret_test/TestAstFunc2/chained-returned-funcs.output deleted file mode 100644 index 1a1d8239..00000000 --- a/lang/interpret_test/TestAstFunc2/chained-returned-funcs.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[hello] diff --git a/lang/interpret_test/TestAstFunc2/chained-returned-funcs/main.mcl b/lang/interpret_test/TestAstFunc2/chained-returned-funcs.txtar similarity index 71% rename from lang/interpret_test/TestAstFunc2/chained-returned-funcs/main.mcl rename to lang/interpret_test/TestAstFunc2/chained-returned-funcs.txtar index 6fb80647..6fe8736f 100644 --- a/lang/interpret_test/TestAstFunc2/chained-returned-funcs/main.mcl +++ b/lang/interpret_test/TestAstFunc2/chained-returned-funcs.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- func funcgen() { func() { func() { @@ -11,3 +12,5 @@ $fn2 = $fn1() $out = $fn2() test $out {} +-- OUTPUT -- +Vertex: test[hello] diff --git a/lang/interpret_test/TestAstFunc2/chained-returned-lambdas.output b/lang/interpret_test/TestAstFunc2/chained-returned-lambdas.output deleted file mode 100644 index 1a1d8239..00000000 --- a/lang/interpret_test/TestAstFunc2/chained-returned-lambdas.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[hello] diff --git a/lang/interpret_test/TestAstFunc2/chained-returned-lambdas/main.mcl b/lang/interpret_test/TestAstFunc2/chained-returned-lambdas.txtar similarity index 81% rename from lang/interpret_test/TestAstFunc2/chained-returned-lambdas/main.mcl rename to lang/interpret_test/TestAstFunc2/chained-returned-lambdas.txtar index 548be45a..50b56e46 100644 --- a/lang/interpret_test/TestAstFunc2/chained-returned-lambdas/main.mcl +++ b/lang/interpret_test/TestAstFunc2/chained-returned-lambdas.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # simple function definition containing function to be returned $funcgen = func() { func() { @@ -15,3 +16,5 @@ $fn3 = $fn2() $out = $fn3() test $out {} +-- OUTPUT -- +Vertex: test[hello] diff --git a/lang/interpret_test/TestAstFunc2/chained-returned-scoped-lambdas.output b/lang/interpret_test/TestAstFunc2/chained-returned-scoped-lambdas.output deleted file mode 100644 index 18cc592e..00000000 --- a/lang/interpret_test/TestAstFunc2/chained-returned-scoped-lambdas.output +++ /dev/null @@ -1,4 +0,0 @@ -Vertex: test[hey] -Vertex: test[there] -Vertex: test[wow: hello] -Vertex: test[wow: world] diff --git a/lang/interpret_test/TestAstFunc2/chained-returned-scoped-lambdas/main.mcl b/lang/interpret_test/TestAstFunc2/chained-returned-scoped-lambdas.txtar similarity index 80% rename from lang/interpret_test/TestAstFunc2/chained-returned-scoped-lambdas/main.mcl rename to lang/interpret_test/TestAstFunc2/chained-returned-scoped-lambdas.txtar index f2bd5a04..ccdc23e1 100644 --- a/lang/interpret_test/TestAstFunc2/chained-returned-scoped-lambdas/main.mcl +++ b/lang/interpret_test/TestAstFunc2/chained-returned-scoped-lambdas.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $funcgen = func() { func($a) { if $a { @@ -36,3 +37,8 @@ test $out1() {} # hey test $out2() {} # there test $out3() {} # wow: hello test $out4() {} # wow: world +-- OUTPUT -- +Vertex: test[hey] +Vertex: test[there] +Vertex: test[wow: hello] +Vertex: test[wow: world] diff --git a/lang/interpret_test/TestAstFunc2/changing-func.output b/lang/interpret_test/TestAstFunc2/changing-func.output deleted file mode 100644 index d025c97b..00000000 --- a/lang/interpret_test/TestAstFunc2/changing-func.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[hello] -Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/changing-func/main.mcl b/lang/interpret_test/TestAstFunc2/changing-func.txtar similarity index 79% rename from lang/interpret_test/TestAstFunc2/changing-func/main.mcl rename to lang/interpret_test/TestAstFunc2/changing-func.txtar index b6f756ef..eff52eb7 100644 --- a/lang/interpret_test/TestAstFunc2/changing-func/main.mcl +++ b/lang/interpret_test/TestAstFunc2/changing-func.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # this can return changing functions, and could be optimized, too func funcgen($b) { if $b { @@ -19,3 +20,6 @@ $out2 = $fn2() test $out1 {} test $out2 {} +-- OUTPUT -- +Vertex: test[hello] +Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/changing-lambda.output b/lang/interpret_test/TestAstFunc2/changing-lambda.output deleted file mode 100644 index d025c97b..00000000 --- a/lang/interpret_test/TestAstFunc2/changing-lambda.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[hello] -Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/changing-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/changing-lambda.txtar similarity index 79% rename from lang/interpret_test/TestAstFunc2/changing-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/changing-lambda.txtar index e9ce3d7c..7b61e977 100644 --- a/lang/interpret_test/TestAstFunc2/changing-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/changing-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # this can return changing functions, and could be optimized, too $funcgen = func($b) { if $b { @@ -19,3 +20,6 @@ $out2 = $fn2() test $out1 {} test $out2 {} +-- OUTPUT -- +Vertex: test[hello] +Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/changing-scoped-lambda.output b/lang/interpret_test/TestAstFunc2/changing-scoped-lambda.output deleted file mode 100644 index 3afd35a0..00000000 --- a/lang/interpret_test/TestAstFunc2/changing-scoped-lambda.output +++ /dev/null @@ -1,4 +0,0 @@ -Vertex: test[true-true] -Vertex: test[true-false] -Vertex: test[false-true] -Vertex: test[false-false] diff --git a/lang/interpret_test/TestAstFunc2/changing-scoped-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/changing-scoped-lambda.txtar similarity index 81% rename from lang/interpret_test/TestAstFunc2/changing-scoped-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/changing-scoped-lambda.txtar index b767f591..bbb99728 100644 --- a/lang/interpret_test/TestAstFunc2/changing-scoped-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/changing-scoped-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # this can return changing functions, and could be optimized, too $funcgen = func($a) { if $a { @@ -39,3 +40,8 @@ test $out1() {} test $out2() {} test $out3() {} test $out4() {} +-- OUTPUT -- +Vertex: test[true-true] +Vertex: test[true-false] +Vertex: test[false-true] +Vertex: test[false-false] diff --git a/lang/interpret_test/TestAstFunc2/class-capture1.output b/lang/interpret_test/TestAstFunc2/class-capture1.output deleted file mode 100644 index 7e2b993a..00000000 --- a/lang/interpret_test/TestAstFunc2/class-capture1.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[t1] diff --git a/lang/interpret_test/TestAstFunc2/class-capture2/main.mcl b/lang/interpret_test/TestAstFunc2/class-capture1.txtar similarity index 52% rename from lang/interpret_test/TestAstFunc2/class-capture2/main.mcl rename to lang/interpret_test/TestAstFunc2/class-capture1.txtar index f8a7c896..952f1f5a 100644 --- a/lang/interpret_test/TestAstFunc2/class-capture2/main.mcl +++ b/lang/interpret_test/TestAstFunc2/class-capture1.txtar @@ -1,5 +1,8 @@ -include foo +-- main.mcl -- +$x1 = "t1" class foo { test $x1 {} } -$x1 = "t1" +include foo +-- OUTPUT -- +Vertex: test[t1] diff --git a/lang/interpret_test/TestAstFunc2/class-capture2.output b/lang/interpret_test/TestAstFunc2/class-capture2.output deleted file mode 100644 index 7e2b993a..00000000 --- a/lang/interpret_test/TestAstFunc2/class-capture2.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[t1] diff --git a/lang/interpret_test/TestAstFunc2/class-capture1/main.mcl b/lang/interpret_test/TestAstFunc2/class-capture2.txtar similarity index 52% rename from lang/interpret_test/TestAstFunc2/class-capture1/main.mcl rename to lang/interpret_test/TestAstFunc2/class-capture2.txtar index b3abb6dd..87cae80c 100644 --- a/lang/interpret_test/TestAstFunc2/class-capture1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/class-capture2.txtar @@ -1,5 +1,8 @@ -$x1 = "t1" +-- main.mcl -- +include foo class foo { test $x1 {} } -include foo +$x1 = "t1" +-- OUTPUT -- +Vertex: test[t1] diff --git a/lang/interpret_test/TestAstFunc2/class-capture3.output b/lang/interpret_test/TestAstFunc2/class-capture3.output deleted file mode 100644 index 7e2b993a..00000000 --- a/lang/interpret_test/TestAstFunc2/class-capture3.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[t1] diff --git a/lang/interpret_test/TestAstFunc2/class-capture3/main.mcl b/lang/interpret_test/TestAstFunc2/class-capture3.txtar similarity index 58% rename from lang/interpret_test/TestAstFunc2/class-capture3/main.mcl rename to lang/interpret_test/TestAstFunc2/class-capture3.txtar index 351fa365..a6082cb8 100644 --- a/lang/interpret_test/TestAstFunc2/class-capture3/main.mcl +++ b/lang/interpret_test/TestAstFunc2/class-capture3.txtar @@ -1,5 +1,8 @@ +-- main.mcl -- $x1 = "bad1" class foo($x1) { test $x1 {} } include foo("t1") +-- OUTPUT -- +Vertex: test[t1] diff --git a/lang/interpret_test/TestAstFunc2/class-capture4.output b/lang/interpret_test/TestAstFunc2/class-capture4.output deleted file mode 100644 index d13cb34b..00000000 --- a/lang/interpret_test/TestAstFunc2/class-capture4.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[t1] -Vertex: test[t2] diff --git a/lang/interpret_test/TestAstFunc2/class-capture4/main.mcl b/lang/interpret_test/TestAstFunc2/class-capture4.txtar similarity index 54% rename from lang/interpret_test/TestAstFunc2/class-capture4/main.mcl rename to lang/interpret_test/TestAstFunc2/class-capture4.txtar index ca67d3cf..25c42bdc 100644 --- a/lang/interpret_test/TestAstFunc2/class-capture4/main.mcl +++ b/lang/interpret_test/TestAstFunc2/class-capture4.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $x1 = "t1" class foo { test $x1 {} @@ -5,3 +6,6 @@ class foo { } include foo $x2 = "t2" +-- OUTPUT -- +Vertex: test[t1] +Vertex: test[t2] diff --git a/lang/interpret_test/TestAstFunc2/class-capture5.output b/lang/interpret_test/TestAstFunc2/class-capture5.output deleted file mode 100644 index 6fc5c94b..00000000 --- a/lang/interpret_test/TestAstFunc2/class-capture5.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[t1: t1] -Vertex: test[t2: t2] diff --git a/lang/interpret_test/TestAstFunc2/class-capture5/main.mcl b/lang/interpret_test/TestAstFunc2/class-capture5.txtar similarity index 64% rename from lang/interpret_test/TestAstFunc2/class-capture5/main.mcl rename to lang/interpret_test/TestAstFunc2/class-capture5.txtar index 70f928be..0c6f071b 100644 --- a/lang/interpret_test/TestAstFunc2/class-capture5/main.mcl +++ b/lang/interpret_test/TestAstFunc2/class-capture5.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $x1 = "bad1" class foo($x1, $x2) { test "t1: " + $x2 {} # swapped @@ -5,3 +6,6 @@ class foo($x1, $x2) { } include foo($x2, "t1") $x2 = "t2" +-- OUTPUT -- +Vertex: test[t1: t1] +Vertex: test[t2: t2] diff --git a/lang/interpret_test/TestAstFunc2/class-capture6.output b/lang/interpret_test/TestAstFunc2/class-capture6.output deleted file mode 100644 index 6752e872..00000000 --- a/lang/interpret_test/TestAstFunc2/class-capture6.output +++ /dev/null @@ -1,3 +0,0 @@ -Vertex: test[t0: t0] -Vertex: test[t1: t1] -Vertex: test[t2: t2] diff --git a/lang/interpret_test/TestAstFunc2/class-capture6/main.mcl b/lang/interpret_test/TestAstFunc2/class-capture6.txtar similarity index 66% rename from lang/interpret_test/TestAstFunc2/class-capture6/main.mcl rename to lang/interpret_test/TestAstFunc2/class-capture6.txtar index 72ca5da1..a06291e9 100644 --- a/lang/interpret_test/TestAstFunc2/class-capture6/main.mcl +++ b/lang/interpret_test/TestAstFunc2/class-capture6.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $x1 = "bad1" class foo($x1, $x2) { include bar @@ -10,3 +11,7 @@ class foo($x1, $x2) { include foo("t1", $x2) $x2 = "t2" $x0 = "t0" +-- OUTPUT -- +Vertex: test[t0: t0] +Vertex: test[t1: t1] +Vertex: test[t2: t2] diff --git a/lang/interpret_test/TestAstFunc2/class-capture7.output b/lang/interpret_test/TestAstFunc2/class-capture7.output deleted file mode 100644 index b82da651..00000000 --- a/lang/interpret_test/TestAstFunc2/class-capture7.output +++ /dev/null @@ -1 +0,0 @@ -# err: errSetScope: class `bar` does not exist in this scope diff --git a/lang/interpret_test/TestAstFunc2/class-capture7/main.mcl b/lang/interpret_test/TestAstFunc2/class-capture7.txtar similarity index 68% rename from lang/interpret_test/TestAstFunc2/class-capture7/main.mcl rename to lang/interpret_test/TestAstFunc2/class-capture7.txtar index 27ede4e7..778d7f8a 100644 --- a/lang/interpret_test/TestAstFunc2/class-capture7/main.mcl +++ b/lang/interpret_test/TestAstFunc2/class-capture7.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- class foo { test "t1" {} class bar { # unused definition @@ -7,3 +8,5 @@ class foo { include foo # This sort of thing is not currently supported, and not sure if it ever will. include bar # nope! +-- OUTPUT -- +# err: errSetScope: class `bar` does not exist in this scope diff --git a/lang/interpret_test/TestAstFunc2/class-capture8.output b/lang/interpret_test/TestAstFunc2/class-capture8.output deleted file mode 100644 index 7e2b993a..00000000 --- a/lang/interpret_test/TestAstFunc2/class-capture8.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[t1] diff --git a/lang/interpret_test/TestAstFunc2/class-capture8.txtar b/lang/interpret_test/TestAstFunc2/class-capture8.txtar new file mode 100644 index 00000000..7d82d6b8 --- /dev/null +++ b/lang/interpret_test/TestAstFunc2/class-capture8.txtar @@ -0,0 +1,12 @@ +-- main.mcl -- +$x1 = "bad1" +include defs.foo + +import "defs.mcl" # out of order for fun +-- defs.mcl -- +class foo { + test $x1 {} # capture the var +} +$x1 = "t1" +-- OUTPUT -- +Vertex: test[t1] diff --git a/lang/interpret_test/TestAstFunc2/class-capture8/defs.mcl b/lang/interpret_test/TestAstFunc2/class-capture8/defs.mcl deleted file mode 100644 index 35569259..00000000 --- a/lang/interpret_test/TestAstFunc2/class-capture8/defs.mcl +++ /dev/null @@ -1,4 +0,0 @@ -class foo { - test $x1 {} # capture the var -} -$x1 = "t1" diff --git a/lang/interpret_test/TestAstFunc2/class-capture8/main.mcl b/lang/interpret_test/TestAstFunc2/class-capture8/main.mcl deleted file mode 100644 index c2343b9e..00000000 --- a/lang/interpret_test/TestAstFunc2/class-capture8/main.mcl +++ /dev/null @@ -1,4 +0,0 @@ -$x1 = "bad1" -include defs.foo - -import "defs.mcl" # out of order for fun diff --git a/lang/interpret_test/TestAstFunc2/class-recursion1.output b/lang/interpret_test/TestAstFunc2/class-recursion1.output deleted file mode 100644 index 879ea314..00000000 --- a/lang/interpret_test/TestAstFunc2/class-recursion1.output +++ /dev/null @@ -1 +0,0 @@ -# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/class-recursion1.txtar b/lang/interpret_test/TestAstFunc2/class-recursion1.txtar new file mode 100644 index 00000000..467c3771 --- /dev/null +++ b/lang/interpret_test/TestAstFunc2/class-recursion1.txtar @@ -0,0 +1,9 @@ +-- main.mcl -- +class c1 { + include c2 +} +class c2 { + include c1 +} +-- OUTPUT -- +# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/class-recursion1/main.mcl b/lang/interpret_test/TestAstFunc2/class-recursion1/main.mcl deleted file mode 100644 index 1c7e6d2f..00000000 --- a/lang/interpret_test/TestAstFunc2/class-recursion1/main.mcl +++ /dev/null @@ -1,6 +0,0 @@ -class c1 { - include c2 -} -class c2 { - include c1 -} diff --git a/lang/interpret_test/TestAstFunc2/class-recursion2.output b/lang/interpret_test/TestAstFunc2/class-recursion2.output deleted file mode 100644 index 879ea314..00000000 --- a/lang/interpret_test/TestAstFunc2/class-recursion2.output +++ /dev/null @@ -1 +0,0 @@ -# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/class-recursion2/main.mcl b/lang/interpret_test/TestAstFunc2/class-recursion2.txtar similarity index 53% rename from lang/interpret_test/TestAstFunc2/class-recursion2/main.mcl rename to lang/interpret_test/TestAstFunc2/class-recursion2.txtar index 822aa7df..7e5efe70 100644 --- a/lang/interpret_test/TestAstFunc2/class-recursion2/main.mcl +++ b/lang/interpret_test/TestAstFunc2/class-recursion2.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- class c1($cond) { test "nope" {} if $cond { @@ -7,3 +8,5 @@ class c1($cond) { } } include c1(true) +-- OUTPUT -- +# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/class-shadowing1.output b/lang/interpret_test/TestAstFunc2/class-shadowing1.output deleted file mode 100644 index 828b0896..00000000 --- a/lang/interpret_test/TestAstFunc2/class-shadowing1.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[d] diff --git a/lang/interpret_test/TestAstFunc2/class-shadowing1/main.mcl b/lang/interpret_test/TestAstFunc2/class-shadowing1.txtar similarity index 74% rename from lang/interpret_test/TestAstFunc2/class-shadowing1/main.mcl rename to lang/interpret_test/TestAstFunc2/class-shadowing1.txtar index 822a1925..0250facc 100644 --- a/lang/interpret_test/TestAstFunc2/class-shadowing1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/class-shadowing1.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $msg = "a" class shadowme($msg) { $msg = "c" @@ -8,3 +9,5 @@ class shadowme($msg) { } include shadowme("b") +-- OUTPUT -- +Vertex: test[d] diff --git a/lang/interpret_test/TestAstFunc2/class-shadowing2.output b/lang/interpret_test/TestAstFunc2/class-shadowing2.output deleted file mode 100644 index af91b7d8..00000000 --- a/lang/interpret_test/TestAstFunc2/class-shadowing2.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[c] diff --git a/lang/interpret_test/TestAstFunc2/class-shadowing2/main.mcl b/lang/interpret_test/TestAstFunc2/class-shadowing2.txtar similarity index 71% rename from lang/interpret_test/TestAstFunc2/class-shadowing2/main.mcl rename to lang/interpret_test/TestAstFunc2/class-shadowing2.txtar index 63e3ad5e..1bb405bf 100644 --- a/lang/interpret_test/TestAstFunc2/class-shadowing2/main.mcl +++ b/lang/interpret_test/TestAstFunc2/class-shadowing2.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $msg = "a" class shadowme($msg) { $msg = "c" @@ -8,3 +9,5 @@ class shadowme($msg) { } include shadowme("b") +-- OUTPUT -- +Vertex: test[c] diff --git a/lang/interpret_test/TestAstFunc2/class-shadowing3.output b/lang/interpret_test/TestAstFunc2/class-shadowing3.output deleted file mode 100644 index ccfda566..00000000 --- a/lang/interpret_test/TestAstFunc2/class-shadowing3.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[a] -Vertex: test[hello] diff --git a/lang/interpret_test/TestAstFunc2/class-shadowing3/main.mcl b/lang/interpret_test/TestAstFunc2/class-shadowing3.txtar similarity index 87% rename from lang/interpret_test/TestAstFunc2/class-shadowing3/main.mcl rename to lang/interpret_test/TestAstFunc2/class-shadowing3.txtar index 2e4eda4d..c0d623d9 100644 --- a/lang/interpret_test/TestAstFunc2/class-shadowing3/main.mcl +++ b/lang/interpret_test/TestAstFunc2/class-shadowing3.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $foo = "a" class c1($cond) { @@ -15,3 +16,6 @@ include c1(true) # but little value. test $foo {} +-- OUTPUT -- +Vertex: test[a] +Vertex: test[hello] diff --git a/lang/interpret_test/TestAstFunc2/complex-conditional-scoped-lambda.output b/lang/interpret_test/TestAstFunc2/complex-conditional-scoped-lambda.output deleted file mode 100644 index db89b0d1..00000000 --- a/lang/interpret_test/TestAstFunc2/complex-conditional-scoped-lambda.output +++ /dev/null @@ -1,3 +0,0 @@ -Vertex: test[hello purpleidea] -Vertex: test[hello user] -Vertex: test[who is there?] diff --git a/lang/interpret_test/TestAstFunc2/complex-conditional-scoped-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/complex-conditional-scoped-lambda.txtar similarity index 77% rename from lang/interpret_test/TestAstFunc2/complex-conditional-scoped-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/complex-conditional-scoped-lambda.txtar index 25cec18f..84e37642 100644 --- a/lang/interpret_test/TestAstFunc2/complex-conditional-scoped-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/complex-conditional-scoped-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $funcgen = func() { func($b) { "hello" + " " + "world" @@ -28,3 +29,7 @@ $out3 = $fn("") test $out1 {} test $out2 {} test $out3 {} +-- OUTPUT -- +Vertex: test[hello purpleidea] +Vertex: test[hello user] +Vertex: test[who is there?] diff --git a/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda-ooo.output b/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda-ooo.output deleted file mode 100644 index 0a108bd1..00000000 --- a/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda-ooo.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[so true] -Vertex: test[so false] diff --git a/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda-ooo/main.mcl b/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda-ooo.txtar similarity index 80% rename from lang/interpret_test/TestAstFunc2/conditional-scoped-lambda-ooo/main.mcl rename to lang/interpret_test/TestAstFunc2/conditional-scoped-lambda-ooo.txtar index c633d222..506b9824 100644 --- a/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda-ooo/main.mcl +++ b/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda-ooo.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # out of order $out1 = $fn(true) $some_bool = false @@ -25,3 +26,6 @@ $funcgen = func() { test $out1 {} test $out2 {} +-- OUTPUT -- +Vertex: test[so true] +Vertex: test[so false] diff --git a/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda.output b/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda.output deleted file mode 100644 index 0a108bd1..00000000 --- a/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[so true] -Vertex: test[so false] diff --git a/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda.txtar similarity index 79% rename from lang/interpret_test/TestAstFunc2/conditional-scoped-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/conditional-scoped-lambda.txtar index 4b4484e4..6dd1732d 100644 --- a/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/conditional-scoped-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $funcgen = func() { func($b) { if $b { @@ -25,3 +26,6 @@ $out2 = $fn(false) test $out1 {} test $out2 {} +-- OUTPUT -- +Vertex: test[so true] +Vertex: test[so false] diff --git a/lang/interpret_test/TestAstFunc2/const1.output b/lang/interpret_test/TestAstFunc2/const1.output deleted file mode 100644 index 29383fea..00000000 --- a/lang/interpret_test/TestAstFunc2/const1.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[exists] diff --git a/lang/interpret_test/TestAstFunc2/const1/main.mcl b/lang/interpret_test/TestAstFunc2/const1.txtar similarity index 65% rename from lang/interpret_test/TestAstFunc2/const1/main.mcl rename to lang/interpret_test/TestAstFunc2/const1.txtar index eeed4a76..8caf6b2f 100644 --- a/lang/interpret_test/TestAstFunc2/const1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/const1.txtar @@ -1,2 +1,5 @@ +-- main.mcl -- # this magic string variable should exist and be "exists" test $const.res.file.state.exists {} +-- OUTPUT -- +Vertex: test[exists] diff --git a/lang/interpret_test/TestAstFunc2/contains0.output b/lang/interpret_test/TestAstFunc2/contains0.output deleted file mode 100644 index fcf9d47f..00000000 --- a/lang/interpret_test/TestAstFunc2/contains0.output +++ /dev/null @@ -1,4 +0,0 @@ -Vertex: test[passed1] -Vertex: test[passed2] -Vertex: test[passed3] -Vertex: test[passed4] diff --git a/lang/interpret_test/TestAstFunc2/contains0/main.mcl b/lang/interpret_test/TestAstFunc2/contains0.txtar similarity index 79% rename from lang/interpret_test/TestAstFunc2/contains0/main.mcl rename to lang/interpret_test/TestAstFunc2/contains0.txtar index 472cae11..1bbbb6fd 100644 --- a/lang/interpret_test/TestAstFunc2/contains0/main.mcl +++ b/lang/interpret_test/TestAstFunc2/contains0.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $ints = [13, 42, 0, -37,] $s1 = if contains(42, $ints) { @@ -35,3 +36,8 @@ test $s1 {} # passed test $s2 {} # passed test $s3 {} # passed test $s4 {} # passed +-- OUTPUT -- +Vertex: test[passed1] +Vertex: test[passed2] +Vertex: test[passed3] +Vertex: test[passed4] diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile0.output b/lang/interpret_test/TestAstFunc2/deploy-readfile0.output deleted file mode 100644 index 4866d5ec..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile0.output +++ /dev/null @@ -1,3 +0,0 @@ -Vertex: test[This is file1 in the files/ folder.] -Vertex: test[This is file2 in the files/ folder.] -Vertex: test[This is file3 in the files/ folder inside of the mod1/ module.] diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile0/main.mcl b/lang/interpret_test/TestAstFunc2/deploy-readfile0.txtar similarity index 53% rename from lang/interpret_test/TestAstFunc2/deploy-readfile0/main.mcl rename to lang/interpret_test/TestAstFunc2/deploy-readfile0.txtar index cbdb4e84..58030385 100644 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile0/main.mcl +++ b/lang/interpret_test/TestAstFunc2/deploy-readfile0.txtar @@ -1,3 +1,6 @@ +-- metadata.yaml -- +#files: "files/" # these are some extra files we can use (is the default) +-- main.mcl -- import "golang/strings" import "deploy" import "second.mcl" @@ -51,3 +54,29 @@ test strings.trim_space($x3) {} #test "f3" { # anotherstr => $x3, #} +-- second.mcl -- +import "deploy" + +# relative paths for us +$f = "/files/file2" # real file is here as well +$f2 = deploy.abspath($f) +$x2 = deploy.readfile($f) +-- files/file1 -- +This is file1 in the files/ folder. +-- files/file2 -- +This is file2 in the files/ folder. +-- mod1/metadata.yaml -- +#files: "files/" # these are some extra files we can use (is the default) +-- mod1/main.mcl -- +import "deploy" + +# relative paths for us +$f = "/files/file3" # real file is in: /mod1/files/file3 +$f3 = deploy.abspath($f) +$x3 = deploy.readfile($f) +-- mod1/files/file3 -- +This is file3 in the files/ folder inside of the mod1/ module. +-- OUTPUT -- +Vertex: test[This is file1 in the files/ folder.] +Vertex: test[This is file2 in the files/ folder.] +Vertex: test[This is file3 in the files/ folder inside of the mod1/ module.] diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile0/files/file1 b/lang/interpret_test/TestAstFunc2/deploy-readfile0/files/file1 deleted file mode 100644 index 51ffcb85..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile0/files/file1 +++ /dev/null @@ -1 +0,0 @@ -This is file1 in the files/ folder. diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile0/files/file2 b/lang/interpret_test/TestAstFunc2/deploy-readfile0/files/file2 deleted file mode 100644 index 60937fb6..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile0/files/file2 +++ /dev/null @@ -1 +0,0 @@ -This is file2 in the files/ folder. diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile0/metadata.yaml b/lang/interpret_test/TestAstFunc2/deploy-readfile0/metadata.yaml deleted file mode 100644 index 5de0af8a..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile0/metadata.yaml +++ /dev/null @@ -1 +0,0 @@ -#files: "files/" # these are some extra files we can use (is the default) diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile0/mod1/files/file3 b/lang/interpret_test/TestAstFunc2/deploy-readfile0/mod1/files/file3 deleted file mode 100644 index 1cbf4aa7..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile0/mod1/files/file3 +++ /dev/null @@ -1 +0,0 @@ -This is file3 in the files/ folder inside of the mod1/ module. diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile0/mod1/main.mcl b/lang/interpret_test/TestAstFunc2/deploy-readfile0/mod1/main.mcl deleted file mode 100644 index 8cf485c4..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile0/mod1/main.mcl +++ /dev/null @@ -1,6 +0,0 @@ -import "deploy" - -# relative paths for us -$f = "/files/file3" # real file is in: /mod1/files/file3 -$f3 = deploy.abspath($f) -$x3 = deploy.readfile($f) diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile0/mod1/metadata.yaml b/lang/interpret_test/TestAstFunc2/deploy-readfile0/mod1/metadata.yaml deleted file mode 100644 index 5de0af8a..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile0/mod1/metadata.yaml +++ /dev/null @@ -1 +0,0 @@ -#files: "files/" # these are some extra files we can use (is the default) diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile0/second.mcl b/lang/interpret_test/TestAstFunc2/deploy-readfile0/second.mcl deleted file mode 100644 index 268016bd..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile0/second.mcl +++ /dev/null @@ -1,6 +0,0 @@ -import "deploy" - -# relative paths for us -$f = "/files/file2" # real file is here as well -$f2 = deploy.abspath($f) -$x2 = deploy.readfile($f) diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile1.output b/lang/interpret_test/TestAstFunc2/deploy-readfile1.output deleted file mode 100644 index 285dc915..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile1.output +++ /dev/null @@ -1,3 +0,0 @@ -Vertex: test[This is a different file1 in the files/ folder.] -Vertex: test[This is a different file2 in the files/ folder.] -Vertex: test[This is a different file3 in the files/ folder inside of the mod1/ module.] diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile1/main.mcl b/lang/interpret_test/TestAstFunc2/deploy-readfile1.txtar similarity index 51% rename from lang/interpret_test/TestAstFunc2/deploy-readfile1/main.mcl rename to lang/interpret_test/TestAstFunc2/deploy-readfile1.txtar index cbdb4e84..9ffbf6b8 100644 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/deploy-readfile1.txtar @@ -1,3 +1,6 @@ +-- metadata.yaml -- +#files: "files/" # these are some extra files we can use (is the default) +-- main.mcl -- import "golang/strings" import "deploy" import "second.mcl" @@ -51,3 +54,29 @@ test strings.trim_space($x3) {} #test "f3" { # anotherstr => $x3, #} +-- second.mcl -- +import "deploy" + +# relative paths for us +$f = "/files/file2" # real file is here as well +$f2 = deploy.abspath($f) +$x2 = deploy.readfile($f) +-- files/file1 -- +This is a different file1 in the files/ folder. +-- files/file2 -- +This is a different file2 in the files/ folder. +-- mod1/metadata.yaml -- +#files: "files/" # these are some extra files we can use (is the default) +-- mod1/main.mcl -- +import "deploy" + +# relative paths for us +$f = "/files/file3" # real file is in: /mod1/files/file3 +$f3 = deploy.abspath($f) +$x3 = deploy.readfile($f) +-- mod1/files/file3 -- +This is a different file3 in the files/ folder inside of the mod1/ module. +-- OUTPUT -- +Vertex: test[This is a different file1 in the files/ folder.] +Vertex: test[This is a different file2 in the files/ folder.] +Vertex: test[This is a different file3 in the files/ folder inside of the mod1/ module.] diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile1/files/file1 b/lang/interpret_test/TestAstFunc2/deploy-readfile1/files/file1 deleted file mode 100644 index da7560c3..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile1/files/file1 +++ /dev/null @@ -1 +0,0 @@ -This is a different file1 in the files/ folder. diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile1/files/file2 b/lang/interpret_test/TestAstFunc2/deploy-readfile1/files/file2 deleted file mode 100644 index 54031eec..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile1/files/file2 +++ /dev/null @@ -1 +0,0 @@ -This is a different file2 in the files/ folder. diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile1/metadata.yaml b/lang/interpret_test/TestAstFunc2/deploy-readfile1/metadata.yaml deleted file mode 100644 index 5de0af8a..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile1/metadata.yaml +++ /dev/null @@ -1 +0,0 @@ -#files: "files/" # these are some extra files we can use (is the default) diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile1/mod1/files/file3 b/lang/interpret_test/TestAstFunc2/deploy-readfile1/mod1/files/file3 deleted file mode 100644 index 14a46305..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile1/mod1/files/file3 +++ /dev/null @@ -1 +0,0 @@ -This is a different file3 in the files/ folder inside of the mod1/ module. diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile1/mod1/main.mcl b/lang/interpret_test/TestAstFunc2/deploy-readfile1/mod1/main.mcl deleted file mode 100644 index 8cf485c4..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile1/mod1/main.mcl +++ /dev/null @@ -1,6 +0,0 @@ -import "deploy" - -# relative paths for us -$f = "/files/file3" # real file is in: /mod1/files/file3 -$f3 = deploy.abspath($f) -$x3 = deploy.readfile($f) diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile1/mod1/metadata.yaml b/lang/interpret_test/TestAstFunc2/deploy-readfile1/mod1/metadata.yaml deleted file mode 100644 index 5de0af8a..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile1/mod1/metadata.yaml +++ /dev/null @@ -1 +0,0 @@ -#files: "files/" # these are some extra files we can use (is the default) diff --git a/lang/interpret_test/TestAstFunc2/deploy-readfile1/second.mcl b/lang/interpret_test/TestAstFunc2/deploy-readfile1/second.mcl deleted file mode 100644 index 268016bd..00000000 --- a/lang/interpret_test/TestAstFunc2/deploy-readfile1/second.mcl +++ /dev/null @@ -1,6 +0,0 @@ -import "deploy" - -# relative paths for us -$f = "/files/file2" # real file is here as well -$f2 = deploy.abspath($f) -$x2 = deploy.readfile($f) diff --git a/lang/interpret_test/TestAstFunc2/efficient-function.output b/lang/interpret_test/TestAstFunc2/efficient-function.output deleted file mode 100644 index 49d49a6d..00000000 --- a/lang/interpret_test/TestAstFunc2/efficient-function.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[hello:a] -Vertex: test[hello:b] diff --git a/lang/interpret_test/TestAstFunc2/efficient-function/main.mcl b/lang/interpret_test/TestAstFunc2/efficient-function.txtar similarity index 73% rename from lang/interpret_test/TestAstFunc2/efficient-function/main.mcl rename to lang/interpret_test/TestAstFunc2/efficient-function.txtar index 2545b868..6f5b23c6 100644 --- a/lang/interpret_test/TestAstFunc2/efficient-function/main.mcl +++ b/lang/interpret_test/TestAstFunc2/efficient-function.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $prefix = "hello" func prefixer($x) { @@ -9,3 +10,6 @@ $out2 = prefixer("b") test $out1 {} # hello:a test $out2 {} # hello:b +-- OUTPUT -- +Vertex: test[hello:a] +Vertex: test[hello:b] diff --git a/lang/interpret_test/TestAstFunc2/efficient-lambda.output b/lang/interpret_test/TestAstFunc2/efficient-lambda.output deleted file mode 100644 index 5c6cfacb..00000000 --- a/lang/interpret_test/TestAstFunc2/efficient-lambda.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[helloa] -Vertex: test[hellob] diff --git a/lang/interpret_test/TestAstFunc2/efficient-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/efficient-lambda.txtar similarity index 77% rename from lang/interpret_test/TestAstFunc2/efficient-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/efficient-lambda.txtar index beaa4d39..7f1ac983 100644 --- a/lang/interpret_test/TestAstFunc2/efficient-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/efficient-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # this should be a function as a value, iow a lambda $prefixer = func($x) { "hello" + $x # i'd only ever expect one "hello" string in the graph @@ -8,3 +9,6 @@ $out2 = $prefixer("b") test $out1 {} # helloa test $out2 {} # hellob +-- OUTPUT -- +Vertex: test[helloa] +Vertex: test[hellob] diff --git a/lang/interpret_test/TestAstFunc2/empty-edge-list-0.output b/lang/interpret_test/TestAstFunc2/empty-edge-list-0.txtar similarity index 65% rename from lang/interpret_test/TestAstFunc2/empty-edge-list-0.output rename to lang/interpret_test/TestAstFunc2/empty-edge-list-0.txtar index 8c639e5a..882d8009 100644 --- a/lang/interpret_test/TestAstFunc2/empty-edge-list-0.output +++ b/lang/interpret_test/TestAstFunc2/empty-edge-list-0.txtar @@ -1,3 +1,23 @@ +-- main.mcl -- +# this must pass type unification and generate output + +# single resource +test "name" {} + +# single resource, defined by list variable +$names = ["hey", "there",] +test $names {} + +# multiples resources, defined by list +test ["hello", "world",] { + Depend => Test[$names], +} + +$morenames = ["wow", "cool", "amazing",] +test $morenames {} + +Test[$names] -> Test[$morenames] +-- OUTPUT -- Edge: test[hey] -> test[amazing] # test[hey] -> test[amazing] Edge: test[hey] -> test[cool] # test[hey] -> test[cool] Edge: test[hey] -> test[hello] # test[hey] -> test[hello] diff --git a/lang/interpret_test/TestAstFunc2/empty-edge-list-0/main.mcl b/lang/interpret_test/TestAstFunc2/empty-edge-list-0/main.mcl deleted file mode 100644 index eb7f7673..00000000 --- a/lang/interpret_test/TestAstFunc2/empty-edge-list-0/main.mcl +++ /dev/null @@ -1,18 +0,0 @@ -# this must pass type unification and generate output - -# single resource -test "name" {} - -# single resource, defined by list variable -$names = ["hey", "there",] -test $names {} - -# multiples resources, defined by list -test ["hello", "world",] { - Depend => Test[$names], -} - -$morenames = ["wow", "cool", "amazing",] -test $morenames {} - -Test[$names] -> Test[$morenames] diff --git a/lang/interpret_test/TestAstFunc2/empty-list.output b/lang/interpret_test/TestAstFunc2/empty-list.output deleted file mode 100644 index 08e8bc52..00000000 --- a/lang/interpret_test/TestAstFunc2/empty-list.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[name] diff --git a/lang/interpret_test/TestAstFunc2/empty-list/main.mcl b/lang/interpret_test/TestAstFunc2/empty-list.txtar similarity index 73% rename from lang/interpret_test/TestAstFunc2/empty-list/main.mcl rename to lang/interpret_test/TestAstFunc2/empty-list.txtar index f9253ef0..60bf330f 100644 --- a/lang/interpret_test/TestAstFunc2/empty-list/main.mcl +++ b/lang/interpret_test/TestAstFunc2/empty-list.txtar @@ -1,5 +1,8 @@ +-- main.mcl -- # make sure the engine works with empty values test "name" { slicestring => [], # empty list mapintfloat => {}, # empty map } +-- OUTPUT -- +Vertex: test[name] diff --git a/lang/interpret_test/TestAstFunc2/escaping0.output b/lang/interpret_test/TestAstFunc2/escaping0.output deleted file mode 100644 index 008cfa5f..00000000 --- a/lang/interpret_test/TestAstFunc2/escaping0.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[x: This is x] diff --git a/lang/interpret_test/TestAstFunc2/escaping0.txtar b/lang/interpret_test/TestAstFunc2/escaping0.txtar new file mode 100644 index 00000000..b78d671f --- /dev/null +++ b/lang/interpret_test/TestAstFunc2/escaping0.txtar @@ -0,0 +1,6 @@ +-- main.mcl -- +# escaping example +$x = "This is x" +test "x: ${x}" {} +-- OUTPUT -- +Vertex: test[x: This is x] diff --git a/lang/interpret_test/TestAstFunc2/escaping0/main.mcl b/lang/interpret_test/TestAstFunc2/escaping0/main.mcl deleted file mode 100644 index 9be5163e..00000000 --- a/lang/interpret_test/TestAstFunc2/escaping0/main.mcl +++ /dev/null @@ -1,3 +0,0 @@ -# escaping example -$x = "This is x" -test "x: ${x}" {} diff --git a/lang/interpret_test/TestAstFunc2/escaping1.output b/lang/interpret_test/TestAstFunc2/escaping1.output deleted file mode 100644 index dd5a3486..00000000 --- a/lang/interpret_test/TestAstFunc2/escaping1.output +++ /dev/null @@ -1,26 +0,0 @@ -Vertex: test[A: ${test}] -Vertex: test[B: $] -Vertex: test[C: This is c1] -Vertex: test[D: \$] -Vertex: test[E: {}] -Vertex: test[F: hello] -Vertex: test[G: This is g1 EOF] -Vertex: test[H: {hhh} EOF] -Vertex: test[I: This is ii EOF] -Vertex: test[J: $ is a dollar sign] -Vertex: test[K: $ {zzz} EOF] -Vertex: test[L: $$This is l1 EOF] -Vertex: test[M: $ $$] -Vertex: test[N: hello " world] -Vertex: test[O: hello "" world] -Vertex: test[P: hello \ world] -Vertex: test[Q: hello \\ world] -Vertex: test[R: \This is r1 EOF] -Vertex: test[S: \$ EOF] -Vertex: test[T: newline -EOF] -Vertex: test[U: tab \ tabEOF] -Vertex: test[W: \$] -Vertex: test[X: $This is x1 EOF] -Vertex: test[Y: ${unused} EOF] -Vertex: test[Z: $$$] diff --git a/lang/interpret_test/TestAstFunc2/escaping1/main.mcl b/lang/interpret_test/TestAstFunc2/escaping1.txtar similarity index 54% rename from lang/interpret_test/TestAstFunc2/escaping1/main.mcl rename to lang/interpret_test/TestAstFunc2/escaping1.txtar index dff9b054..1906754d 100644 --- a/lang/interpret_test/TestAstFunc2/escaping1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/escaping1.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # escaping examples test "A: \${test}" {} @@ -60,3 +61,30 @@ $y1 = "{unused}" test "Y: $${y1} EOF" {} # check there isn't double parsing test "Z: $$$" {} +-- OUTPUT -- +Vertex: test[A: ${test}] +Vertex: test[B: $] +Vertex: test[C: This is c1] +Vertex: test[D: \$] +Vertex: test[E: {}] +Vertex: test[F: hello] +Vertex: test[G: This is g1 EOF] +Vertex: test[H: {hhh} EOF] +Vertex: test[I: This is ii EOF] +Vertex: test[J: $ is a dollar sign] +Vertex: test[K: $ {zzz} EOF] +Vertex: test[L: $$This is l1 EOF] +Vertex: test[M: $ $$] +Vertex: test[N: hello " world] +Vertex: test[O: hello "" world] +Vertex: test[P: hello \ world] +Vertex: test[Q: hello \\ world] +Vertex: test[R: \This is r1 EOF] +Vertex: test[S: \$ EOF] +Vertex: test[T: newline +EOF] +Vertex: test[U: tab \ tabEOF] +Vertex: test[W: \$] +Vertex: test[X: $This is x1 EOF] +Vertex: test[Y: ${unused} EOF] +Vertex: test[Z: $$$] diff --git a/lang/interpret_test/TestAstFunc2/escaping2.output b/lang/interpret_test/TestAstFunc2/escaping2.output deleted file mode 100644 index f3a3c2e3..00000000 --- a/lang/interpret_test/TestAstFunc2/escaping2.output +++ /dev/null @@ -1 +0,0 @@ -# err: errInterpolate: parser failed: cannot parse string: X: ${foo()} diff --git a/lang/interpret_test/TestAstFunc2/escaping2.txtar b/lang/interpret_test/TestAstFunc2/escaping2.txtar new file mode 100644 index 00000000..424d874c --- /dev/null +++ b/lang/interpret_test/TestAstFunc2/escaping2.txtar @@ -0,0 +1,5 @@ +-- main.mcl -- +# this is invalid (you can't have a function inside a var lookup) +test "X: ${foo()}" {} +-- OUTPUT -- +# err: errInterpolate: parser failed: cannot parse string: X: ${foo()} diff --git a/lang/interpret_test/TestAstFunc2/escaping2/main.mcl b/lang/interpret_test/TestAstFunc2/escaping2/main.mcl deleted file mode 100644 index 96affb85..00000000 --- a/lang/interpret_test/TestAstFunc2/escaping2/main.mcl +++ /dev/null @@ -1,2 +0,0 @@ -# this is invalid (you can't have a function inside a var lookup) -test "X: ${foo()}" {} diff --git a/lang/interpret_test/TestAstFunc2/escaping3.output b/lang/interpret_test/TestAstFunc2/escaping3.output deleted file mode 100644 index a9aef197..00000000 --- a/lang/interpret_test/TestAstFunc2/escaping3.output +++ /dev/null @@ -1 +0,0 @@ -# err: errInterpolate: parser failed: cannot parse string: X: ${} diff --git a/lang/interpret_test/TestAstFunc2/escaping3.txtar b/lang/interpret_test/TestAstFunc2/escaping3.txtar new file mode 100644 index 00000000..f0a93399 --- /dev/null +++ b/lang/interpret_test/TestAstFunc2/escaping3.txtar @@ -0,0 +1,5 @@ +-- main.mcl -- +# this is invalid (you can't have an empty var lookup) +test "X: ${}" {} +-- OUTPUT -- +# err: errInterpolate: parser failed: cannot parse string: X: ${} diff --git a/lang/interpret_test/TestAstFunc2/escaping3/main.mcl b/lang/interpret_test/TestAstFunc2/escaping3/main.mcl deleted file mode 100644 index f4088afd..00000000 --- a/lang/interpret_test/TestAstFunc2/escaping3/main.mcl +++ /dev/null @@ -1,2 +0,0 @@ -# this is invalid (you can't have an empty var lookup) -test "X: ${}" {} diff --git a/lang/interpret_test/TestAstFunc2/escaping4.output b/lang/interpret_test/TestAstFunc2/escaping4.output deleted file mode 100644 index a75274ec..00000000 --- a/lang/interpret_test/TestAstFunc2/escaping4.output +++ /dev/null @@ -1 +0,0 @@ -# err: errInterpolate: parser failed: unknown escape sequence: \z diff --git a/lang/interpret_test/TestAstFunc2/escaping4.txtar b/lang/interpret_test/TestAstFunc2/escaping4.txtar new file mode 100644 index 00000000..a3b7801b --- /dev/null +++ b/lang/interpret_test/TestAstFunc2/escaping4.txtar @@ -0,0 +1,5 @@ +-- main.mcl -- +# this is invalid (you can't escape a z, right?) +test "X: \z" {} +-- OUTPUT -- +# err: errInterpolate: parser failed: unknown escape sequence: \z diff --git a/lang/interpret_test/TestAstFunc2/escaping4/main.mcl b/lang/interpret_test/TestAstFunc2/escaping4/main.mcl deleted file mode 100644 index 760de6c3..00000000 --- a/lang/interpret_test/TestAstFunc2/escaping4/main.mcl +++ /dev/null @@ -1,2 +0,0 @@ -# this is invalid (you can't escape a z, right?) -test "X: \z" {} diff --git a/lang/interpret_test/TestAstFunc2/escaping5.output b/lang/interpret_test/TestAstFunc2/escaping5.output deleted file mode 100644 index c81498b1..00000000 --- a/lang/interpret_test/TestAstFunc2/escaping5.output +++ /dev/null @@ -1 +0,0 @@ -# err: errInterpolate: parser failed: unknown escape sequence: \j diff --git a/lang/interpret_test/TestAstFunc2/escaping5.txtar b/lang/interpret_test/TestAstFunc2/escaping5.txtar new file mode 100644 index 00000000..9d30c5c3 --- /dev/null +++ b/lang/interpret_test/TestAstFunc2/escaping5.txtar @@ -0,0 +1,5 @@ +-- main.mcl -- +# this is invalid (there's no \j escape sequence) +test "X: there is no \j sequence" {} +-- OUTPUT -- +# err: errInterpolate: parser failed: unknown escape sequence: \j diff --git a/lang/interpret_test/TestAstFunc2/escaping5/main.mcl b/lang/interpret_test/TestAstFunc2/escaping5/main.mcl deleted file mode 100644 index a8f3afe7..00000000 --- a/lang/interpret_test/TestAstFunc2/escaping5/main.mcl +++ /dev/null @@ -1,2 +0,0 @@ -# this is invalid (there's no \j escape sequence) -test "X: there is no \j sequence" {} diff --git a/lang/interpret_test/TestAstFunc2/example.txtar b/lang/interpret_test/TestAstFunc2/example.txtar new file mode 100644 index 00000000..4770d420 --- /dev/null +++ b/lang/interpret_test/TestAstFunc2/example.txtar @@ -0,0 +1,12 @@ +some comment can go here! + +-- main.mcl -- +import "fmt" + +test fmt.printf("answer: %d", 42) {} +-- files/file1 -- +this is file1 +-- files/file2 -- +this is file2 +-- OUTPUT -- +Vertex: test[answer: 42] diff --git a/lang/interpret_test/TestAstFunc2/file-fragments1.output b/lang/interpret_test/TestAstFunc2/file-fragments1.output deleted file mode 100644 index 75b9337f..00000000 --- a/lang/interpret_test/TestAstFunc2/file-fragments1.output +++ /dev/null @@ -1,11 +0,0 @@ -Edge: file[/tmp/frags/] -> file[/tmp/frags/f1] # file[/tmp/frags/] -> file[/tmp/frags/f1] (autoedge) -Edge: file[/tmp/frags/] -> file[/tmp/frags/f2] # file[/tmp/frags/] -> file[/tmp/frags/f2] (autoedge) -Edge: file[/tmp/frags/] -> file[/tmp/frags/f3] # file[/tmp/frags/] -> file[/tmp/frags/f3] (autoedge) -Edge: file[/tmp/bonus_file] -> file[/tmp/whole1] # file[/tmp/bonus_file] -> file[/tmp/whole1] (autoedge) -Edge: file[/tmp/frags/] -> file[/tmp/whole1] # file[/tmp/frags/] -> file[/tmp/whole1] (autoedge) -Vertex: file[/tmp/bonus_file] -Vertex: file[/tmp/frags/] -Vertex: file[/tmp/frags/f1] -Vertex: file[/tmp/frags/f2] -Vertex: file[/tmp/frags/f3] -Vertex: file[/tmp/whole1] diff --git a/lang/interpret_test/TestAstFunc2/file-fragments1/main.mcl b/lang/interpret_test/TestAstFunc2/file-fragments1.txtar similarity index 53% rename from lang/interpret_test/TestAstFunc2/file-fragments1/main.mcl rename to lang/interpret_test/TestAstFunc2/file-fragments1.txtar index 7d0991c7..fe9d1acb 100644 --- a/lang/interpret_test/TestAstFunc2/file-fragments1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/file-fragments1.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- file "/tmp/frags/" { state => $const.res.file.state.exists, } @@ -31,3 +32,15 @@ file "/tmp/whole1" { "/tmp/bonus_file", # also pull this one file ], } +-- OUTPUT -- +Edge: file[/tmp/frags/] -> file[/tmp/frags/f1] # file[/tmp/frags/] -> file[/tmp/frags/f1] (autoedge) +Edge: file[/tmp/frags/] -> file[/tmp/frags/f2] # file[/tmp/frags/] -> file[/tmp/frags/f2] (autoedge) +Edge: file[/tmp/frags/] -> file[/tmp/frags/f3] # file[/tmp/frags/] -> file[/tmp/frags/f3] (autoedge) +Edge: file[/tmp/bonus_file] -> file[/tmp/whole1] # file[/tmp/bonus_file] -> file[/tmp/whole1] (autoedge) +Edge: file[/tmp/frags/] -> file[/tmp/whole1] # file[/tmp/frags/] -> file[/tmp/whole1] (autoedge) +Vertex: file[/tmp/bonus_file] +Vertex: file[/tmp/frags/] +Vertex: file[/tmp/frags/f1] +Vertex: file[/tmp/frags/f2] +Vertex: file[/tmp/frags/f3] +Vertex: file[/tmp/whole1] diff --git a/lang/interpret_test/TestAstFunc2/fortytwo.output b/lang/interpret_test/TestAstFunc2/fortytwo.output deleted file mode 100644 index a8afdb37..00000000 --- a/lang/interpret_test/TestAstFunc2/fortytwo.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[float: 42] -Vertex: test[int: 42] diff --git a/lang/interpret_test/TestAstFunc2/fortytwo/main.mcl b/lang/interpret_test/TestAstFunc2/fortytwo.txtar similarity index 78% rename from lang/interpret_test/TestAstFunc2/fortytwo/main.mcl rename to lang/interpret_test/TestAstFunc2/fortytwo.txtar index 3e888213..2f35082a 100644 --- a/lang/interpret_test/TestAstFunc2/fortytwo/main.mcl +++ b/lang/interpret_test/TestAstFunc2/fortytwo.txtar @@ -1,6 +1,10 @@ +-- main.mcl -- import "fmt" import "math" # FIXME: floats don't print nicely: https://github.com/golang/go/issues/46118 # FIXME: This means that we see "42" for both, instead of 42.0 ... test fmt.printf("int: %d", math.fortytwo()) {} test fmt.printf("float: %f", math.fortytwo()) {} +-- OUTPUT -- +Vertex: test[float: 42] +Vertex: test[int: 42] diff --git a/lang/interpret_test/TestAstFunc2/func-gen1.output b/lang/interpret_test/TestAstFunc2/func-gen1.output deleted file mode 100644 index 7f5b009f..00000000 --- a/lang/interpret_test/TestAstFunc2/func-gen1.output +++ /dev/null @@ -1 +0,0 @@ -# err: errSetScope: func `fun1` does not exist in this scope diff --git a/lang/interpret_test/TestAstFunc2/func-gen1/main.mcl b/lang/interpret_test/TestAstFunc2/func-gen1.txtar similarity index 73% rename from lang/interpret_test/TestAstFunc2/func-gen1/main.mcl rename to lang/interpret_test/TestAstFunc2/func-gen1.txtar index c5e1a6d9..d36838e6 100644 --- a/lang/interpret_test/TestAstFunc2/func-gen1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/func-gen1.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # This sort of thing is not currently supported, and not sure if it ever will. # test generating a function @@ -9,3 +10,5 @@ class funcgen1 { include funcgen1 $x1 = fun1() # not funcgen1.fun1 since it's *not* an import! test $x1 {} # hi +-- OUTPUT -- +# err: errSetScope: func `fun1` does not exist in this scope diff --git a/lang/interpret_test/TestAstFunc2/func-gen2.output b/lang/interpret_test/TestAstFunc2/func-gen2.output deleted file mode 100644 index 2e3faa32..00000000 --- a/lang/interpret_test/TestAstFunc2/func-gen2.output +++ /dev/null @@ -1 +0,0 @@ -# err: errSetScope: func `fun2` does not exist in this scope diff --git a/lang/interpret_test/TestAstFunc2/func-gen2/main.mcl b/lang/interpret_test/TestAstFunc2/func-gen2.txtar similarity index 80% rename from lang/interpret_test/TestAstFunc2/func-gen2/main.mcl rename to lang/interpret_test/TestAstFunc2/func-gen2.txtar index 27aeda5f..72337afa 100644 --- a/lang/interpret_test/TestAstFunc2/func-gen2/main.mcl +++ b/lang/interpret_test/TestAstFunc2/func-gen2.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # This sort of thing is not currently supported, and not sure if it ever will. # test generating a function with outside scoping @@ -12,3 +13,5 @@ $const2 = "world" # added here to confirm any-order rules include funcgen2 $x2 = fun2() # not funcgen2.fun2 since it's *not* an import! test $x2 {} # hello world +-- OUTPUT -- +# err: errSetScope: func `fun2` does not exist in this scope diff --git a/lang/interpret_test/TestAstFunc2/func-math1.output b/lang/interpret_test/TestAstFunc2/func-math1.output deleted file mode 100644 index a86ee659..00000000 --- a/lang/interpret_test/TestAstFunc2/func-math1.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[sq1: 13] -Vertex: test[sq2: 42] diff --git a/lang/interpret_test/TestAstFunc2/func-math1/main.mcl b/lang/interpret_test/TestAstFunc2/func-math1.txtar similarity index 78% rename from lang/interpret_test/TestAstFunc2/func-math1/main.mcl rename to lang/interpret_test/TestAstFunc2/func-math1.txtar index 6b41c8ae..0c50de85 100644 --- a/lang/interpret_test/TestAstFunc2/func-math1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/func-math1.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # function statement @@ -15,3 +16,6 @@ $x2 = $sq2(7, -7) # 7^2 + 2 = 42 test fmt.printf("sq1: %d", $x1) {} test fmt.printf("sq2: %d", $x2) {} +-- OUTPUT -- +Vertex: test[sq1: 13] +Vertex: test[sq2: 42] diff --git a/lang/interpret_test/TestAstFunc2/func-shadowing1.output b/lang/interpret_test/TestAstFunc2/func-shadowing1.output deleted file mode 100644 index 5a72b413..00000000 --- a/lang/interpret_test/TestAstFunc2/func-shadowing1.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[hello world] diff --git a/lang/interpret_test/TestAstFunc2/func-shadowing1/main.mcl b/lang/interpret_test/TestAstFunc2/func-shadowing1.txtar similarity index 63% rename from lang/interpret_test/TestAstFunc2/func-shadowing1/main.mcl rename to lang/interpret_test/TestAstFunc2/func-shadowing1.txtar index 52272054..64396ad8 100644 --- a/lang/interpret_test/TestAstFunc2/func-shadowing1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/func-shadowing1.txtar @@ -1,5 +1,8 @@ +-- main.mcl -- $foo = "bad1" func bar($foo) { "hello " + $foo # shadows parent var } test bar("world") {} +-- OUTPUT -- +Vertex: test[hello world] diff --git a/lang/interpret_test/TestAstFunc2/func-shadowing2.output b/lang/interpret_test/TestAstFunc2/func-shadowing2.output deleted file mode 100644 index 5a72b413..00000000 --- a/lang/interpret_test/TestAstFunc2/func-shadowing2.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[hello world] diff --git a/lang/interpret_test/TestAstFunc2/func-shadowing2/main.mcl b/lang/interpret_test/TestAstFunc2/func-shadowing2.txtar similarity index 64% rename from lang/interpret_test/TestAstFunc2/func-shadowing2/main.mcl rename to lang/interpret_test/TestAstFunc2/func-shadowing2.txtar index da9e8699..ec416b4c 100644 --- a/lang/interpret_test/TestAstFunc2/func-shadowing2/main.mcl +++ b/lang/interpret_test/TestAstFunc2/func-shadowing2.txtar @@ -1,5 +1,8 @@ +-- main.mcl -- $foo = "bad1" $bar = func($foo) { "hello " + $foo # shadows parent var } test $bar("world") {} +-- OUTPUT -- +Vertex: test[hello world] diff --git a/lang/interpret_test/TestAstFunc2/good-unification.output b/lang/interpret_test/TestAstFunc2/good-unification.output deleted file mode 100644 index 143f49c8..00000000 --- a/lang/interpret_test/TestAstFunc2/good-unification.output +++ /dev/null @@ -1,3 +0,0 @@ -Vertex: test[goodbye] -Vertex: test[hello world] -Vertex: test[hey] diff --git a/lang/interpret_test/TestAstFunc2/good-unification/main.mcl b/lang/interpret_test/TestAstFunc2/good-unification.txtar similarity index 82% rename from lang/interpret_test/TestAstFunc2/good-unification/main.mcl rename to lang/interpret_test/TestAstFunc2/good-unification.txtar index 204d8588..ea0ddf37 100644 --- a/lang/interpret_test/TestAstFunc2/good-unification/main.mcl +++ b/lang/interpret_test/TestAstFunc2/good-unification.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $funcgen1 = func() { func($b) { $b + " " + "world" @@ -39,3 +40,7 @@ test $out2 {} $fn3 = $funcgen3() $out3 = $fn3("goodbye") test $out3() {} +-- OUTPUT -- +Vertex: test[goodbye] +Vertex: test[hello world] +Vertex: test[hey] diff --git a/lang/interpret_test/TestAstFunc2/invalid-function-call.output b/lang/interpret_test/TestAstFunc2/invalid-function-call.output deleted file mode 100644 index c1dd271e..00000000 --- a/lang/interpret_test/TestAstFunc2/invalid-function-call.output +++ /dev/null @@ -1 +0,0 @@ -# err: errUnify: expected: Func, got: Int diff --git a/lang/interpret_test/TestAstFunc2/invalid-function-call/main.mcl b/lang/interpret_test/TestAstFunc2/invalid-function-call.txtar similarity index 62% rename from lang/interpret_test/TestAstFunc2/invalid-function-call/main.mcl rename to lang/interpret_test/TestAstFunc2/invalid-function-call.txtar index a10835c6..92d1a3b2 100644 --- a/lang/interpret_test/TestAstFunc2/invalid-function-call/main.mcl +++ b/lang/interpret_test/TestAstFunc2/invalid-function-call.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # function expression @@ -8,3 +9,5 @@ $x = $notfn(7) print "msg" { msg => fmt.printf("notfn: %d", $x), } +-- OUTPUT -- +# err: errUnify: expected: Func, got: Int diff --git a/lang/interpret_test/TestAstFunc2/lambda-chained.output b/lang/interpret_test/TestAstFunc2/lambda-chained.output deleted file mode 100644 index edffc2bf..00000000 --- a/lang/interpret_test/TestAstFunc2/lambda-chained.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[hello:world] -Vertex: test[hello:hello:world] diff --git a/lang/interpret_test/TestAstFunc2/lambda-chained/main.mcl b/lang/interpret_test/TestAstFunc2/lambda-chained.txtar similarity index 73% rename from lang/interpret_test/TestAstFunc2/lambda-chained/main.mcl rename to lang/interpret_test/TestAstFunc2/lambda-chained.txtar index e0e4cce6..2b6382ad 100644 --- a/lang/interpret_test/TestAstFunc2/lambda-chained/main.mcl +++ b/lang/interpret_test/TestAstFunc2/lambda-chained.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $prefix = "hello" # this should be a function as a value, iow a lambda @@ -10,3 +11,6 @@ $out2 = $prefixer($out1) test $out1 {} test $out2 {} +-- OUTPUT -- +Vertex: test[hello:world] +Vertex: test[hello:hello:world] diff --git a/lang/interpret_test/TestAstFunc2/lambda-scope-args.output b/lang/interpret_test/TestAstFunc2/lambda-scope-args.output deleted file mode 100644 index 53adea76..00000000 --- a/lang/interpret_test/TestAstFunc2/lambda-scope-args.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[42 * 13 * 37 is 20202] diff --git a/lang/interpret_test/TestAstFunc2/lambda-scope-args/main.mcl b/lang/interpret_test/TestAstFunc2/lambda-scope-args.txtar similarity index 83% rename from lang/interpret_test/TestAstFunc2/lambda-scope-args/main.mcl rename to lang/interpret_test/TestAstFunc2/lambda-scope-args.txtar index e33896ec..ec4b0828 100644 --- a/lang/interpret_test/TestAstFunc2/lambda-scope-args/main.mcl +++ b/lang/interpret_test/TestAstFunc2/lambda-scope-args.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # test a function with part of the expression scoped from outside @@ -11,3 +12,5 @@ $num = 13 $out = $constmult($num) # 20202 test fmt.printf("%d * %d * %d is %d", $c1, $num, $c2, $out) {} +-- OUTPUT -- +Vertex: test[42 * 13 * 37 is 20202] diff --git a/lang/interpret_test/TestAstFunc2/lambda-with-nested-poly-func.output b/lang/interpret_test/TestAstFunc2/lambda-with-nested-poly-func.output deleted file mode 100644 index 4a565602..00000000 --- a/lang/interpret_test/TestAstFunc2/lambda-with-nested-poly-func.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[2 + 2 is 4] diff --git a/lang/interpret_test/TestAstFunc2/lambda-with-nested-poly-func/main.mcl b/lang/interpret_test/TestAstFunc2/lambda-with-nested-poly-func.txtar similarity index 73% rename from lang/interpret_test/TestAstFunc2/lambda-with-nested-poly-func/main.mcl rename to lang/interpret_test/TestAstFunc2/lambda-with-nested-poly-func.txtar index 0b403b77..a06a55f2 100644 --- a/lang/interpret_test/TestAstFunc2/lambda-with-nested-poly-func/main.mcl +++ b/lang/interpret_test/TestAstFunc2/lambda-with-nested-poly-func.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" $add = func($x) { @@ -8,3 +9,5 @@ $num = 2 $out = $add($num) # 4 test fmt.printf("%d + %d is %d", $num, $num, $out) {} # simple math +-- OUTPUT -- +Vertex: test[2 + 2 is 4] diff --git a/lang/interpret_test/TestAstFunc2/lambdafunc-recursive-double.output b/lang/interpret_test/TestAstFunc2/lambdafunc-recursive-double.output deleted file mode 100644 index 879ea314..00000000 --- a/lang/interpret_test/TestAstFunc2/lambdafunc-recursive-double.output +++ /dev/null @@ -1 +0,0 @@ -# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/lambdafunc-recursive-double/main.mcl b/lang/interpret_test/TestAstFunc2/lambdafunc-recursive-double.txtar similarity index 84% rename from lang/interpret_test/TestAstFunc2/lambdafunc-recursive-double/main.mcl rename to lang/interpret_test/TestAstFunc2/lambdafunc-recursive-double.txtar index 53842c75..770fe517 100644 --- a/lang/interpret_test/TestAstFunc2/lambdafunc-recursive-double/main.mcl +++ b/lang/interpret_test/TestAstFunc2/lambdafunc-recursive-double.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # recursive function (not supported!) @@ -29,3 +30,5 @@ $out2 = $sum2(-5) # -5 + -4 + -3 + -2 + -1 + -0 = -15 test fmt.printf("sum1(4) is %d", $out1) {} test fmt.printf("sum2(-5) is %d", $out2) {} +-- OUTPUT -- +# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/lambdafunc-recursive.output b/lang/interpret_test/TestAstFunc2/lambdafunc-recursive.output deleted file mode 100644 index 879ea314..00000000 --- a/lang/interpret_test/TestAstFunc2/lambdafunc-recursive.output +++ /dev/null @@ -1 +0,0 @@ -# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/lambdafunc-recursive/main.mcl b/lang/interpret_test/TestAstFunc2/lambdafunc-recursive.txtar similarity index 79% rename from lang/interpret_test/TestAstFunc2/lambdafunc-recursive/main.mcl rename to lang/interpret_test/TestAstFunc2/lambdafunc-recursive.txtar index 84432731..d44fbbc7 100644 --- a/lang/interpret_test/TestAstFunc2/lambdafunc-recursive/main.mcl +++ b/lang/interpret_test/TestAstFunc2/lambdafunc-recursive.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # recursive function (not supported!) @@ -18,3 +19,5 @@ $out2 = $sum(-5) # -5 + -4 + -3 + -2 + -1 + -0 = -15 test fmt.printf("sum(4) is %d", $out1) {} test fmt.printf("sum(-5) is %d", $out2) {} +-- OUTPUT -- +# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/map-iterator0.TODO b/lang/interpret_test/TestAstFunc2/map-iterator0.TODO deleted file mode 100644 index 73b09b24..00000000 --- a/lang/interpret_test/TestAstFunc2/map-iterator0.TODO +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[out1: [1 2 3 4 5]] diff --git a/lang/interpret_test/TestAstFunc2/map-iterator0/main.mcl b/lang/interpret_test/TestAstFunc2/map-iterator0.txtar.TODO similarity index 80% rename from lang/interpret_test/TestAstFunc2/map-iterator0/main.mcl rename to lang/interpret_test/TestAstFunc2/map-iterator0.txtar.TODO index 697b589a..f2cc6e57 100644 --- a/lang/interpret_test/TestAstFunc2/map-iterator0/main.mcl +++ b/lang/interpret_test/TestAstFunc2/map-iterator0.txtar.TODO @@ -1,3 +1,4 @@ +-- main.mcl -- import "iter" $fn = func($x) { # notable because concrete type is fn(t1) t2, where t1 != t2 @@ -11,3 +12,5 @@ $out1 = iter.xmap($in1, $fn) # XXX: change to map $t1 = template("out1: {{ . }}", $out1) test $t1 {} +-- OUTPUT -- +Vertex: test[out1: [1 2 3 4 5]] diff --git a/lang/interpret_test/TestAstFunc2/map-iterator1.TODO b/lang/interpret_test/TestAstFunc2/map-iterator1.TODO deleted file mode 100644 index bd2326be..00000000 --- a/lang/interpret_test/TestAstFunc2/map-iterator1.TODO +++ /dev/null @@ -1,4 +0,0 @@ -Vertex: test[out1: [10 8 6 4 2]] -Vertex: test[out2: [aa bb cc dd ee]] -Vertex: test[out3: [10 8 6 4 2]] -Vertex: test[out4: [aa bb cc dd ee]] diff --git a/lang/interpret_test/TestAstFunc2/map-iterator1/main.mcl b/lang/interpret_test/TestAstFunc2/map-iterator1.txtar.TODO similarity index 77% rename from lang/interpret_test/TestAstFunc2/map-iterator1/main.mcl rename to lang/interpret_test/TestAstFunc2/map-iterator1.txtar.TODO index 137d6e00..dc4ccf20 100644 --- a/lang/interpret_test/TestAstFunc2/map-iterator1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/map-iterator1.txtar.TODO @@ -1,3 +1,4 @@ +-- main.mcl -- import "iter" func iterxmap($a, $b) { # XXX: change to map @@ -25,3 +26,8 @@ test $t1 {} test $t2 {} test $t3 {} test $t4 {} +-- OUTPUT -- +Vertex: test[out1: [10 8 6 4 2]] +Vertex: test[out2: [aa bb cc dd ee]] +Vertex: test[out3: [10 8 6 4 2]] +Vertex: test[out4: [aa bb cc dd ee]] diff --git a/lang/interpret_test/TestAstFunc2/map-iterator2.TODO b/lang/interpret_test/TestAstFunc2/map-iterator2.TODO deleted file mode 100644 index aca55eb7..00000000 --- a/lang/interpret_test/TestAstFunc2/map-iterator2.TODO +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[out: [42 42 42 42 42]] diff --git a/lang/interpret_test/TestAstFunc2/map-iterator2/main.mcl b/lang/interpret_test/TestAstFunc2/map-iterator2.txtar.TODO similarity index 72% rename from lang/interpret_test/TestAstFunc2/map-iterator2/main.mcl rename to lang/interpret_test/TestAstFunc2/map-iterator2.txtar.TODO index 57e4180e..aca65502 100644 --- a/lang/interpret_test/TestAstFunc2/map-iterator2/main.mcl +++ b/lang/interpret_test/TestAstFunc2/map-iterator2.txtar.TODO @@ -1,3 +1,4 @@ +-- main.mcl -- import "iter" $fn = func($x) { # ignore arg @@ -11,3 +12,5 @@ $out = iter.xmap($in, $fn) # XXX: change to map $t = template("out: {{ . }}", $out) test $t {} +-- OUTPUT -- +Vertex: test[out: [42 42 42 42 42]] diff --git a/lang/interpret_test/TestAstFunc2/map-iterator3.TODO b/lang/interpret_test/TestAstFunc2/map-iterator3.TODO deleted file mode 100644 index 0053f70d..00000000 --- a/lang/interpret_test/TestAstFunc2/map-iterator3.TODO +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[out: [1 2 3 4 5]] diff --git a/lang/interpret_test/TestAstFunc2/map-iterator3/main.mcl b/lang/interpret_test/TestAstFunc2/map-iterator3.txtar.TODO similarity index 78% rename from lang/interpret_test/TestAstFunc2/map-iterator3/main.mcl rename to lang/interpret_test/TestAstFunc2/map-iterator3.txtar.TODO index c8a5fb1d..1ae4f098 100644 --- a/lang/interpret_test/TestAstFunc2/map-iterator3/main.mcl +++ b/lang/interpret_test/TestAstFunc2/map-iterator3.txtar.TODO @@ -1,3 +1,4 @@ +-- main.mcl -- import "iter" $fn = func($x) { # type changes from str to int @@ -11,3 +12,5 @@ $out = iter.xmap($in, $fn) # XXX: change to map $t = template("out: {{ . }}", $out) test $t {} +-- OUTPUT -- +Vertex: test[out: [1 2 3 4 5]] diff --git a/lang/interpret_test/TestAstFunc2/map-iterator4.TODO b/lang/interpret_test/TestAstFunc2/map-iterator4.TODO deleted file mode 100644 index 0053f70d..00000000 --- a/lang/interpret_test/TestAstFunc2/map-iterator4.TODO +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[out: [1 2 3 4 5]] diff --git a/lang/interpret_test/TestAstFunc2/map-iterator4/main.mcl b/lang/interpret_test/TestAstFunc2/map-iterator4.txtar.TODO similarity index 80% rename from lang/interpret_test/TestAstFunc2/map-iterator4/main.mcl rename to lang/interpret_test/TestAstFunc2/map-iterator4.txtar.TODO index c1dd44c2..20be31a3 100644 --- a/lang/interpret_test/TestAstFunc2/map-iterator4/main.mcl +++ b/lang/interpret_test/TestAstFunc2/map-iterator4.txtar.TODO @@ -1,3 +1,4 @@ +-- main.mcl -- import "iter" $in = ["a", "bb", "ccc", "dddd", "eeeee",] @@ -11,3 +12,5 @@ $out = iter.xmap($in, func($x) { $t = template("out: {{ . }}", $out) test $t {} +-- OUTPUT -- +Vertex: test[out: [1 2 3 4 5]] diff --git a/lang/interpret_test/TestAstFunc2/maplookup0.output b/lang/interpret_test/TestAstFunc2/maplookup0.output deleted file mode 100644 index 78d7568f..00000000 --- a/lang/interpret_test/TestAstFunc2/maplookup0.output +++ /dev/null @@ -1,4 +0,0 @@ -Vertex: test[hello1] -Vertex: test[hello3] -Vertex: test[world2] -Vertex: test[world4] diff --git a/lang/interpret_test/TestAstFunc2/maplookup0/main.mcl b/lang/interpret_test/TestAstFunc2/maplookup0.txtar similarity index 72% rename from lang/interpret_test/TestAstFunc2/maplookup0/main.mcl rename to lang/interpret_test/TestAstFunc2/maplookup0.txtar index a644e654..d1bb0890 100644 --- a/lang/interpret_test/TestAstFunc2/maplookup0/main.mcl +++ b/lang/interpret_test/TestAstFunc2/maplookup0.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $map1 map{int: str} = {42 => "hello1",} test maplookup($map1, 42, "not found") {} @@ -9,3 +10,8 @@ test maplookup($map3, 42, "not found") {} $map4 = {42 => "hello4",} test maplookup($map4, 13, "world4") {} +-- OUTPUT -- +Vertex: test[hello1] +Vertex: test[hello3] +Vertex: test[world2] +Vertex: test[world4] diff --git a/lang/interpret_test/TestAstFunc2/nested-changing-scoped-lambda.output b/lang/interpret_test/TestAstFunc2/nested-changing-scoped-lambda.output deleted file mode 100644 index 559404c0..00000000 --- a/lang/interpret_test/TestAstFunc2/nested-changing-scoped-lambda.output +++ /dev/null @@ -1,5 +0,0 @@ -Vertex: test[true-true-10] -Vertex: test[true-false-20] -Vertex: test[true-false-negative] -Vertex: test[false-true-big] -Vertex: test[false-false-some-world] diff --git a/lang/interpret_test/TestAstFunc2/nested-changing-scoped-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/nested-changing-scoped-lambda.txtar similarity index 83% rename from lang/interpret_test/TestAstFunc2/nested-changing-scoped-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/nested-changing-scoped-lambda.txtar index 5c533c28..1975a01f 100644 --- a/lang/interpret_test/TestAstFunc2/nested-changing-scoped-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/nested-changing-scoped-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # this can return changing functions, and could be optimized, too $funcgen = func($a) { @@ -50,3 +51,9 @@ test if true { $out2(20) } else { $out2(-20) } {} test if false { $out2(20) } else { $out2(-20) } {} test $out3(30) {} test $out4(40) {} +-- OUTPUT -- +Vertex: test[true-true-10] +Vertex: test[true-false-20] +Vertex: test[true-false-negative] +Vertex: test[false-true-big] +Vertex: test[false-false-some-world] diff --git a/lang/interpret_test/TestAstFunc2/nested-conditional-scoped-lambda.output b/lang/interpret_test/TestAstFunc2/nested-conditional-scoped-lambda.output deleted file mode 100644 index 69b4a45a..00000000 --- a/lang/interpret_test/TestAstFunc2/nested-conditional-scoped-lambda.output +++ /dev/null @@ -1,3 +0,0 @@ -Vertex: test[text: hello james, count: 35] -Vertex: test[text: hello magic number, count: 42] -Vertex: test[text: hello user, count: 14] diff --git a/lang/interpret_test/TestAstFunc2/nested-conditional-scoped-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/nested-conditional-scoped-lambda.txtar similarity index 79% rename from lang/interpret_test/TestAstFunc2/nested-conditional-scoped-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/nested-conditional-scoped-lambda.txtar index 399943d8..b8fa68a1 100644 --- a/lang/interpret_test/TestAstFunc2/nested-conditional-scoped-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/nested-conditional-scoped-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" $funcgen1 = func($a, $d) { @@ -46,3 +47,7 @@ $out3 = $fn3(0) test $out1 {} test $out2 {} test $out3 {} +-- OUTPUT -- +Vertex: test[text: hello james, count: 35] +Vertex: test[text: hello magic number, count: 42] +Vertex: test[text: hello user, count: 14] diff --git a/lang/interpret_test/TestAstFunc2/nested-import0.output b/lang/interpret_test/TestAstFunc2/nested-import0.output deleted file mode 100644 index 8cc700c7..00000000 --- a/lang/interpret_test/TestAstFunc2/nested-import0.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[Hello!] diff --git a/lang/interpret_test/TestAstFunc2/nested-import0/main.mcl b/lang/interpret_test/TestAstFunc2/nested-import0.txtar similarity index 53% rename from lang/interpret_test/TestAstFunc2/nested-import0/main.mcl rename to lang/interpret_test/TestAstFunc2/nested-import0.txtar index 8d414dee..986a8bf2 100644 --- a/lang/interpret_test/TestAstFunc2/nested-import0/main.mcl +++ b/lang/interpret_test/TestAstFunc2/nested-import0.txtar @@ -1,5 +1,8 @@ +-- main.mcl -- import "example/nested" $x = nested.hello() test $x {} +-- OUTPUT -- +Vertex: test[Hello!] diff --git a/lang/interpret_test/TestAstFunc2/nested-import1.output b/lang/interpret_test/TestAstFunc2/nested-import1.output deleted file mode 100644 index 8cc700c7..00000000 --- a/lang/interpret_test/TestAstFunc2/nested-import1.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[Hello!] diff --git a/lang/interpret_test/TestAstFunc2/nested-import1/main.mcl b/lang/interpret_test/TestAstFunc2/nested-import1.txtar similarity index 55% rename from lang/interpret_test/TestAstFunc2/nested-import1/main.mcl rename to lang/interpret_test/TestAstFunc2/nested-import1.txtar index 48ca5190..df6f908e 100644 --- a/lang/interpret_test/TestAstFunc2/nested-import1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/nested-import1.txtar @@ -1,5 +1,8 @@ +-- main.mcl -- import "example/nested" as foo $x = foo.hello() test $x {} +-- OUTPUT -- +Vertex: test[Hello!] diff --git a/lang/interpret_test/TestAstFunc2/polymorphic-lambda.output b/lang/interpret_test/TestAstFunc2/polymorphic-lambda.output deleted file mode 100644 index 6ec122ea..00000000 --- a/lang/interpret_test/TestAstFunc2/polymorphic-lambda.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[2 + 2 is 4] -Vertex: test[hello + hello is hellohello] diff --git a/lang/interpret_test/TestAstFunc2/polymorphic-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/polymorphic-lambda.txtar similarity index 81% rename from lang/interpret_test/TestAstFunc2/polymorphic-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/polymorphic-lambda.txtar index eb54eec0..de840673 100644 --- a/lang/interpret_test/TestAstFunc2/polymorphic-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/polymorphic-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # TODO: should this be allowed? it means the func value has two different types! @@ -15,3 +16,6 @@ $val = "hello" $out2 = $add($val) # hellohello test fmt.printf("%s + %s is %s", $val, $val, $out2) {} # simple concat +-- OUTPUT -- +Vertex: test[2 + 2 is 4] +Vertex: test[hello + hello is hellohello] diff --git a/lang/interpret_test/TestAstFunc2/polymorphic-stmt-func.output b/lang/interpret_test/TestAstFunc2/polymorphic-stmt-func.output deleted file mode 100644 index 6ec122ea..00000000 --- a/lang/interpret_test/TestAstFunc2/polymorphic-stmt-func.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[2 + 2 is 4] -Vertex: test[hello + hello is hellohello] diff --git a/lang/interpret_test/TestAstFunc2/polymorphic-stmt-func/main.mcl b/lang/interpret_test/TestAstFunc2/polymorphic-stmt-func.txtar similarity index 76% rename from lang/interpret_test/TestAstFunc2/polymorphic-stmt-func/main.mcl rename to lang/interpret_test/TestAstFunc2/polymorphic-stmt-func.txtar index 71a89221..bede726d 100644 --- a/lang/interpret_test/TestAstFunc2/polymorphic-stmt-func/main.mcl +++ b/lang/interpret_test/TestAstFunc2/polymorphic-stmt-func.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # this should be a regular polymorphic function @@ -14,3 +15,6 @@ $val = "hello" $out2 = add($val) # hellohello test fmt.printf("%s + %s is %s", $val, $val, $out2) {} # simple concat +-- OUTPUT -- +Vertex: test[2 + 2 is 4] +Vertex: test[hello + hello is hellohello] diff --git a/lang/interpret_test/TestAstFunc2/printfinterpolate0.output b/lang/interpret_test/TestAstFunc2/printfinterpolate0.output deleted file mode 100644 index c040f8ca..00000000 --- a/lang/interpret_test/TestAstFunc2/printfinterpolate0.output +++ /dev/null @@ -1 +0,0 @@ -# err: errUnify: only recursive solutions left diff --git a/lang/interpret_test/TestAstFunc2/printfinterpolate0/main.mcl b/lang/interpret_test/TestAstFunc2/printfinterpolate0.txtar similarity index 78% rename from lang/interpret_test/TestAstFunc2/printfinterpolate0/main.mcl rename to lang/interpret_test/TestAstFunc2/printfinterpolate0.txtar index 4a227571..da74f9c7 100644 --- a/lang/interpret_test/TestAstFunc2/printfinterpolate0/main.mcl +++ b/lang/interpret_test/TestAstFunc2/printfinterpolate0.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" $str1 = "big" @@ -8,3 +9,5 @@ $str2 = "world" print "print1" { msg => fmt.printf("hello ${str1} %s", $str2), } +-- OUTPUT -- +# err: errUnify: only recursive solutions left diff --git a/lang/interpret_test/TestAstFunc2/printfsimple0.output b/lang/interpret_test/TestAstFunc2/printfsimple0.output deleted file mode 100644 index b7747cff..00000000 --- a/lang/interpret_test/TestAstFunc2/printfsimple0.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[the answer is 42] diff --git a/lang/interpret_test/TestAstFunc2/printfsimple0/main.mcl b/lang/interpret_test/TestAstFunc2/printfsimple0.txtar similarity index 54% rename from lang/interpret_test/TestAstFunc2/printfsimple0/main.mcl rename to lang/interpret_test/TestAstFunc2/printfsimple0.txtar index 1f3d6a98..417117a8 100644 --- a/lang/interpret_test/TestAstFunc2/printfsimple0/main.mcl +++ b/lang/interpret_test/TestAstFunc2/printfsimple0.txtar @@ -1,5 +1,8 @@ +-- main.mcl -- import "fmt" $out = 42 test fmt.printf("the answer is %d", $out) {} +-- OUTPUT -- +Vertex: test[the answer is 42] diff --git a/lang/interpret_test/TestAstFunc2/returned-func.output b/lang/interpret_test/TestAstFunc2/returned-func.output deleted file mode 100644 index 1a1d8239..00000000 --- a/lang/interpret_test/TestAstFunc2/returned-func.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[hello] diff --git a/lang/interpret_test/TestAstFunc2/returned-func/main.mcl b/lang/interpret_test/TestAstFunc2/returned-func.txtar similarity index 75% rename from lang/interpret_test/TestAstFunc2/returned-func/main.mcl rename to lang/interpret_test/TestAstFunc2/returned-func.txtar index 19e13a93..07df383c 100644 --- a/lang/interpret_test/TestAstFunc2/returned-func/main.mcl +++ b/lang/interpret_test/TestAstFunc2/returned-func.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # simple function definition containing function to be returned func funcgen() { func() { @@ -9,3 +10,5 @@ $fn = funcgen() $out = $fn() test $out {} +-- OUTPUT -- +Vertex: test[hello] diff --git a/lang/interpret_test/TestAstFunc2/returned-lambda.output b/lang/interpret_test/TestAstFunc2/returned-lambda.output deleted file mode 100644 index 1a1d8239..00000000 --- a/lang/interpret_test/TestAstFunc2/returned-lambda.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[hello] diff --git a/lang/interpret_test/TestAstFunc2/returned-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/returned-lambda.txtar similarity index 65% rename from lang/interpret_test/TestAstFunc2/returned-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/returned-lambda.txtar index cdcf24b2..8814cf43 100644 --- a/lang/interpret_test/TestAstFunc2/returned-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/returned-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $funcgen = func() { func() { "hello" @@ -8,3 +9,5 @@ $fn = $funcgen() $out = $fn() test $out {} +-- OUTPUT -- +Vertex: test[hello] diff --git a/lang/interpret_test/TestAstFunc2/scoped-lambda.output b/lang/interpret_test/TestAstFunc2/scoped-lambda.output deleted file mode 100644 index d025c97b..00000000 --- a/lang/interpret_test/TestAstFunc2/scoped-lambda.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[hello] -Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/scoped-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/scoped-lambda.txtar similarity index 80% rename from lang/interpret_test/TestAstFunc2/scoped-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/scoped-lambda.txtar index 10975647..a6348e14 100644 --- a/lang/interpret_test/TestAstFunc2/scoped-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/scoped-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # this can return changing functions, and could be optimized, too $funcgen = func() { func($b) { @@ -20,3 +21,6 @@ $out2 = $fn(false) test $out1() {} test $out2() {} +-- OUTPUT -- +Vertex: test[hello] +Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/send-recv-0.output b/lang/interpret_test/TestAstFunc2/send-recv-0.output deleted file mode 100644 index 0754c939..00000000 --- a/lang/interpret_test/TestAstFunc2/send-recv-0.output +++ /dev/null @@ -1,7 +0,0 @@ -Edge: exec[exec0] -> file[/tmp/command-output] # exec[exec0] -> file[/tmp/command-output] -Edge: exec[exec0] -> file[/tmp/command-stderr] # exec[exec0] -> file[/tmp/command-stderr] -Edge: exec[exec0] -> file[/tmp/command-stdout] # exec[exec0] -> file[/tmp/command-stdout] -Vertex: exec[exec0] -Vertex: file[/tmp/command-output] -Vertex: file[/tmp/command-stderr] -Vertex: file[/tmp/command-stdout] diff --git a/lang/interpret_test/TestAstFunc2/send-recv-0/main.mcl b/lang/interpret_test/TestAstFunc2/send-recv-0.txtar similarity index 50% rename from lang/interpret_test/TestAstFunc2/send-recv-0/main.mcl rename to lang/interpret_test/TestAstFunc2/send-recv-0.txtar index 77ec9128..b5c5f8f6 100644 --- a/lang/interpret_test/TestAstFunc2/send-recv-0/main.mcl +++ b/lang/interpret_test/TestAstFunc2/send-recv-0.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- exec "exec0" { cmd => "echo this is stdout && echo this is stderr 1>&2", # to stdout && stderr shell => "/bin/bash", @@ -10,3 +11,11 @@ file ["/tmp/command-output", "/tmp/command-stdout", "/tmp/command-stderr",] { Exec["exec0"].output -> File["/tmp/command-output"].content Exec["exec0"].stdout -> File["/tmp/command-stdout"].content Exec["exec0"].stderr -> File["/tmp/command-stderr"].content +-- OUTPUT -- +Edge: exec[exec0] -> file[/tmp/command-output] # exec[exec0] -> file[/tmp/command-output] +Edge: exec[exec0] -> file[/tmp/command-stderr] # exec[exec0] -> file[/tmp/command-stderr] +Edge: exec[exec0] -> file[/tmp/command-stdout] # exec[exec0] -> file[/tmp/command-stdout] +Vertex: exec[exec0] +Vertex: file[/tmp/command-output] +Vertex: file[/tmp/command-stderr] +Vertex: file[/tmp/command-stdout] diff --git a/lang/interpret_test/TestAstFunc2/send-recv-1.output b/lang/interpret_test/TestAstFunc2/send-recv-1.output deleted file mode 100644 index 2750b61a..00000000 --- a/lang/interpret_test/TestAstFunc2/send-recv-1.output +++ /dev/null @@ -1 +0,0 @@ -# err: errUnify: cannot send/recv from exec[exec0].shell to file[/tmp/command-output].content: key not found in send struct diff --git a/lang/interpret_test/TestAstFunc2/send-recv-1/main.mcl b/lang/interpret_test/TestAstFunc2/send-recv-1.txtar similarity index 63% rename from lang/interpret_test/TestAstFunc2/send-recv-1/main.mcl rename to lang/interpret_test/TestAstFunc2/send-recv-1.txtar index 1ba8ecd5..2951bc96 100644 --- a/lang/interpret_test/TestAstFunc2/send-recv-1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/send-recv-1.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- exec "exec0" { cmd => "echo whatever", shell => "/bin/bash", @@ -9,3 +10,5 @@ file "/tmp/command-output" { # this is an error because the shell send key doesn't exist in exec Exec["exec0"].shell -> File["/tmp/command-output"].content +-- OUTPUT -- +# err: errUnify: cannot send/recv from exec[exec0].shell to file[/tmp/command-output].content: key not found in send struct diff --git a/lang/interpret_test/TestAstFunc2/send-recv-2.output b/lang/interpret_test/TestAstFunc2/send-recv-2.output deleted file mode 100644 index a3ace930..00000000 --- a/lang/interpret_test/TestAstFunc2/send-recv-2.output +++ /dev/null @@ -1 +0,0 @@ -# err: errInterpret: resource: `file[/tmp/command-output]` has duplicate receive on: `content` param diff --git a/lang/interpret_test/TestAstFunc2/send-recv-2/main.mcl b/lang/interpret_test/TestAstFunc2/send-recv-2.txtar similarity index 69% rename from lang/interpret_test/TestAstFunc2/send-recv-2/main.mcl rename to lang/interpret_test/TestAstFunc2/send-recv-2.txtar index 75afaf3c..a5e1885b 100644 --- a/lang/interpret_test/TestAstFunc2/send-recv-2/main.mcl +++ b/lang/interpret_test/TestAstFunc2/send-recv-2.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- exec ["exec0", "exec1",] { cmd => "echo whatever", shell => "/bin/bash", @@ -9,3 +10,5 @@ file "/tmp/command-output" { # this is an error because two senders cannot send to the same receiver key Exec[["exec0", "exec1",]].output -> File["/tmp/command-output"].content +-- OUTPUT -- +# err: errInterpret: resource: `file[/tmp/command-output]` has duplicate receive on: `content` param diff --git a/lang/interpret_test/TestAstFunc2/shadowing1.output b/lang/interpret_test/TestAstFunc2/shadowing1.output deleted file mode 100644 index 1a1d8239..00000000 --- a/lang/interpret_test/TestAstFunc2/shadowing1.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[hello] diff --git a/lang/interpret_test/TestAstFunc2/shadowing1/main.mcl b/lang/interpret_test/TestAstFunc2/shadowing1.txtar similarity index 69% rename from lang/interpret_test/TestAstFunc2/shadowing1/main.mcl rename to lang/interpret_test/TestAstFunc2/shadowing1.txtar index fee1876c..19e005ab 100644 --- a/lang/interpret_test/TestAstFunc2/shadowing1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/shadowing1.txtar @@ -1,6 +1,9 @@ +-- main.mcl -- # this should be okay, because var is shadowed $x = "hello" if true { $x = "world" # shadowed } test $x {} +-- OUTPUT -- +Vertex: test[hello] diff --git a/lang/interpret_test/TestAstFunc2/shadowing2.output b/lang/interpret_test/TestAstFunc2/shadowing2.output deleted file mode 100644 index f7305817..00000000 --- a/lang/interpret_test/TestAstFunc2/shadowing2.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/shadowing2/main.mcl b/lang/interpret_test/TestAstFunc2/shadowing2.txtar similarity index 69% rename from lang/interpret_test/TestAstFunc2/shadowing2/main.mcl rename to lang/interpret_test/TestAstFunc2/shadowing2.txtar index 7569279f..7f8b0dd0 100644 --- a/lang/interpret_test/TestAstFunc2/shadowing2/main.mcl +++ b/lang/interpret_test/TestAstFunc2/shadowing2.txtar @@ -1,6 +1,9 @@ +-- main.mcl -- # this should be okay, because var is shadowed $x = "hello" if true { $x = "world" # shadowed test $x {} } +-- OUTPUT -- +Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-ooo.output b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-ooo.output deleted file mode 100644 index 2fa831b7..00000000 --- a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-ooo.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[worldwide] diff --git a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-ooo/main.mcl b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-ooo.txtar similarity index 81% rename from lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-ooo/main.mcl rename to lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-ooo.txtar index 7361cc1a..f7873662 100644 --- a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-ooo/main.mcl +++ b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-ooo.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # out of order $funcgen1 = func() { func($b) { @@ -17,3 +18,5 @@ $funcgen2 = func() { } $out = $fn("wide") test $out {} +-- OUTPUT -- +Vertex: test[worldwide] diff --git a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-very-ooo.output b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-very-ooo.output deleted file mode 100644 index 2fa831b7..00000000 --- a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-very-ooo.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[worldwide] diff --git a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-very-ooo/main.mcl b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-very-ooo.txtar similarity index 82% rename from lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-very-ooo/main.mcl rename to lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-very-ooo.txtar index b6dc0efe..a2845195 100644 --- a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-very-ooo/main.mcl +++ b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args-very-ooo.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # very out of order $funcgen1 = func() { func($b) { @@ -17,3 +18,5 @@ $funcgen2 = func() { "world" + $bb } } +-- OUTPUT -- +Vertex: test[worldwide] diff --git a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args.output b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args.output deleted file mode 100644 index 2fa831b7..00000000 --- a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[worldwide] diff --git a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args/main.mcl b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args.txtar similarity index 80% rename from lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args/main.mcl rename to lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args.txtar index 57fb689d..09ae2ef2 100644 --- a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args/main.mcl +++ b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call-args.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $funcgen1 = func() { func($b) { "hello" + $b @@ -18,3 +19,5 @@ $fn = if $some_bool { $out = $fn("wide") test $out {} +-- OUTPUT -- +Vertex: test[worldwide] diff --git a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call.output b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call.output deleted file mode 100644 index f7305817..00000000 --- a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call/main.mcl b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call.txtar similarity index 81% rename from lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call/main.mcl rename to lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call.txtar index 573e4d06..cb7c759f 100644 --- a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call/main.mcl +++ b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda-call.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $funcgen1 = func() { func($b) { "hello" @@ -18,3 +19,5 @@ $fn = if $some_bool { $out = $fn(false) test $out {} +-- OUTPUT -- +Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda.output b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda.output deleted file mode 100644 index f7305817..00000000 --- a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda.txtar similarity index 77% rename from lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda.txtar index 972076d7..7ae0e5e8 100644 --- a/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/simple-conditional-scoped-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $funcgen = func() { func($b) { "hello" @@ -15,3 +16,5 @@ $fn = if $some_bool { $out = $fn(false) test $out {} +-- OUTPUT -- +Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/simple-lambda-args.output b/lang/interpret_test/TestAstFunc2/simple-lambda-args.output deleted file mode 100644 index 8c1921dd..00000000 --- a/lang/interpret_test/TestAstFunc2/simple-lambda-args.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[4 * 4 is 16] diff --git a/lang/interpret_test/TestAstFunc2/simple-lambda-args/main.mcl b/lang/interpret_test/TestAstFunc2/simple-lambda-args.txtar similarity index 77% rename from lang/interpret_test/TestAstFunc2/simple-lambda-args/main.mcl rename to lang/interpret_test/TestAstFunc2/simple-lambda-args.txtar index 228cc357..e6129e8f 100644 --- a/lang/interpret_test/TestAstFunc2/simple-lambda-args/main.mcl +++ b/lang/interpret_test/TestAstFunc2/simple-lambda-args.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # this should be a function as a value, iow a lambda @@ -9,3 +10,5 @@ $num = 4 $out = $square($num) test fmt.printf("%d * %d is %d", $num, $num, $out) {} +-- OUTPUT -- +Vertex: test[4 * 4 is 16] diff --git a/lang/interpret_test/TestAstFunc2/simple-lambda-scope.output b/lang/interpret_test/TestAstFunc2/simple-lambda-scope.output deleted file mode 100644 index b7747cff..00000000 --- a/lang/interpret_test/TestAstFunc2/simple-lambda-scope.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[the answer is 42] diff --git a/lang/interpret_test/TestAstFunc2/simple-lambda-scope/main.mcl b/lang/interpret_test/TestAstFunc2/simple-lambda-scope.txtar similarity index 75% rename from lang/interpret_test/TestAstFunc2/simple-lambda-scope/main.mcl rename to lang/interpret_test/TestAstFunc2/simple-lambda-scope.txtar index 1d593589..a0606ea2 100644 --- a/lang/interpret_test/TestAstFunc2/simple-lambda-scope/main.mcl +++ b/lang/interpret_test/TestAstFunc2/simple-lambda-scope.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # this should be a function as a value, iow a lambda @@ -9,3 +10,5 @@ $answer = func() { $out = $answer() test fmt.printf("the answer is %d", $out) {} +-- OUTPUT -- +Vertex: test[the answer is 42] diff --git a/lang/interpret_test/TestAstFunc2/simple-lambda1.output b/lang/interpret_test/TestAstFunc2/simple-lambda1.output deleted file mode 100644 index b7747cff..00000000 --- a/lang/interpret_test/TestAstFunc2/simple-lambda1.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[the answer is 42] diff --git a/lang/interpret_test/TestAstFunc2/simple-lambda1/main.mcl b/lang/interpret_test/TestAstFunc2/simple-lambda1.txtar similarity index 70% rename from lang/interpret_test/TestAstFunc2/simple-lambda1/main.mcl rename to lang/interpret_test/TestAstFunc2/simple-lambda1.txtar index 37d25bbe..88c13bbf 100644 --- a/lang/interpret_test/TestAstFunc2/simple-lambda1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/simple-lambda1.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # this should be a function as a value, iow a lambda @@ -8,3 +9,5 @@ $answer = func() { $out = $answer() test $out {} +-- OUTPUT -- +Vertex: test[the answer is 42] diff --git a/lang/interpret_test/TestAstFunc2/simple-lambda2.output b/lang/interpret_test/TestAstFunc2/simple-lambda2.output deleted file mode 100644 index a9035db0..00000000 --- a/lang/interpret_test/TestAstFunc2/simple-lambda2.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[the answer is 42the answer is 42] diff --git a/lang/interpret_test/TestAstFunc2/simple-lambda2/main.mcl b/lang/interpret_test/TestAstFunc2/simple-lambda2.txtar similarity index 69% rename from lang/interpret_test/TestAstFunc2/simple-lambda2/main.mcl rename to lang/interpret_test/TestAstFunc2/simple-lambda2.txtar index 9be77fe9..f105faed 100644 --- a/lang/interpret_test/TestAstFunc2/simple-lambda2/main.mcl +++ b/lang/interpret_test/TestAstFunc2/simple-lambda2.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # this should be a function as a value, iow a lambda @@ -9,3 +10,5 @@ $out1 = $answer() $out2 = $answer() test $out1 + $out2 {} +-- OUTPUT -- +Vertex: test[the answer is 42the answer is 42] diff --git a/lang/interpret_test/TestAstFunc2/simple-scope-ordering.output b/lang/interpret_test/TestAstFunc2/simple-scope-ordering.output deleted file mode 100644 index 7dcd5018..00000000 --- a/lang/interpret_test/TestAstFunc2/simple-scope-ordering.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[a] -Vertex: test[b] diff --git a/lang/interpret_test/TestAstFunc2/simple-scope-ordering/main.mcl b/lang/interpret_test/TestAstFunc2/simple-scope-ordering.txtar similarity index 76% rename from lang/interpret_test/TestAstFunc2/simple-scope-ordering/main.mcl rename to lang/interpret_test/TestAstFunc2/simple-scope-ordering.txtar index 9c3bc846..2166b075 100644 --- a/lang/interpret_test/TestAstFunc2/simple-scope-ordering/main.mcl +++ b/lang/interpret_test/TestAstFunc2/simple-scope-ordering.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # set scope ordering test if $foo { $bar = true @@ -17,3 +18,6 @@ if $bar { $foo = true $bar = false +-- OUTPUT -- +Vertex: test[a] +Vertex: test[b] diff --git a/lang/interpret_test/TestAstFunc2/simple-scoped-lambda.output b/lang/interpret_test/TestAstFunc2/simple-scoped-lambda.output deleted file mode 100644 index d025c97b..00000000 --- a/lang/interpret_test/TestAstFunc2/simple-scoped-lambda.output +++ /dev/null @@ -1,2 +0,0 @@ -Vertex: test[hello] -Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/simple-scoped-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/simple-scoped-lambda.txtar similarity index 77% rename from lang/interpret_test/TestAstFunc2/simple-scoped-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/simple-scoped-lambda.txtar index 4f664249..7dd8cea9 100644 --- a/lang/interpret_test/TestAstFunc2/simple-scoped-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/simple-scoped-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # this can return changing functions, and could be optimized, too $funcgen = func() { func($b) { @@ -15,3 +16,6 @@ $out2 = $fn(false) test $out1 {} test $out2 {} +-- OUTPUT -- +Vertex: test[hello] +Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/slow-unification1.output b/lang/interpret_test/TestAstFunc2/slow-unification1.output deleted file mode 100644 index 045e486c..00000000 --- a/lang/interpret_test/TestAstFunc2/slow-unification1.output +++ /dev/null @@ -1,31 +0,0 @@ -Vertex: print[flipflop-a] -Vertex: print[flipflop-b] -Vertex: print[flipflop-bar] -Vertex: print[flipflop-c] -Vertex: print[flipflop-d] -Vertex: print[flipflop-e] -Vertex: print[flipflop-f] -Vertex: print[flipflop-foo] -Vertex: print[flipflop-g] -Vertex: print[flipflop-h] -Vertex: print[flipflop-hello world] -Vertex: print[flipflop-i] -Vertex: print[flipflop-j] -Vertex: print[flipflop-k] -Vertex: print[flipflop-l] -Vertex: print[flipflop-m] -Vertex: print[flipflop-meep] -Vertex: print[flipflop-moop] -Vertex: print[flipflop-n] -Vertex: print[flipflop-o] -Vertex: print[flipflop-p] -Vertex: print[flipflop-q] -Vertex: print[flipflop-r] -Vertex: print[flipflop-s] -Vertex: print[flipflop-t] -Vertex: print[flipflop-u] -Vertex: print[flipflop-v] -Vertex: print[flipflop-w] -Vertex: print[flipflop-x] -Vertex: print[flipflop-y] -Vertex: print[flipflop-z] diff --git a/lang/interpret_test/TestAstFunc2/slow-unification1.txtar b/lang/interpret_test/TestAstFunc2/slow-unification1.txtar new file mode 100644 index 00000000..2d2393f4 --- /dev/null +++ b/lang/interpret_test/TestAstFunc2/slow-unification1.txtar @@ -0,0 +1,76 @@ +-- main.mcl -- +import "datetime" +import "math" + +class foo($bar) { + $now = datetime.now() + $x = math.mod($now, 2) + print "flipflop-${bar}" { + msg => if $x == 0 { "FLIP" } else { "FLOP" }, + } +} + +# Increasing the number of these, used to cause the performance to tank after 5. +include foo("hello world") +include foo("meep") +include foo("moop") +include foo("foo") +include foo("bar") +include foo("a") +include foo("b") +include foo("c") +include foo("d") +include foo("e") +include foo("f") +include foo("g") +include foo("h") +include foo("i") +include foo("j") +include foo("k") +include foo("l") +include foo("m") +include foo("n") +include foo("o") +include foo("p") +include foo("q") +include foo("r") +include foo("s") +include foo("t") +include foo("u") +include foo("v") +include foo("w") +include foo("x") +include foo("y") +include foo("z") +-- OUTPUT -- +Vertex: print[flipflop-a] +Vertex: print[flipflop-b] +Vertex: print[flipflop-bar] +Vertex: print[flipflop-c] +Vertex: print[flipflop-d] +Vertex: print[flipflop-e] +Vertex: print[flipflop-f] +Vertex: print[flipflop-foo] +Vertex: print[flipflop-g] +Vertex: print[flipflop-h] +Vertex: print[flipflop-hello world] +Vertex: print[flipflop-i] +Vertex: print[flipflop-j] +Vertex: print[flipflop-k] +Vertex: print[flipflop-l] +Vertex: print[flipflop-m] +Vertex: print[flipflop-meep] +Vertex: print[flipflop-moop] +Vertex: print[flipflop-n] +Vertex: print[flipflop-o] +Vertex: print[flipflop-p] +Vertex: print[flipflop-q] +Vertex: print[flipflop-r] +Vertex: print[flipflop-s] +Vertex: print[flipflop-t] +Vertex: print[flipflop-u] +Vertex: print[flipflop-v] +Vertex: print[flipflop-w] +Vertex: print[flipflop-x] +Vertex: print[flipflop-y] +Vertex: print[flipflop-z] diff --git a/lang/interpret_test/TestAstFunc2/slow-unification1/main.mcl b/lang/interpret_test/TestAstFunc2/slow-unification1/main.mcl deleted file mode 100644 index 8cfa8405..00000000 --- a/lang/interpret_test/TestAstFunc2/slow-unification1/main.mcl +++ /dev/null @@ -1,43 +0,0 @@ -import "datetime" -import "math" - -class foo($bar) { - $now = datetime.now() - $x = math.mod($now, 2) - print "flipflop-${bar}" { - msg => if $x == 0 { "FLIP" } else { "FLOP" }, - } -} - -# Increasing the number of these, used to cause the performance to tank after 5. -include foo("hello world") -include foo("meep") -include foo("moop") -include foo("foo") -include foo("bar") -include foo("a") -include foo("b") -include foo("c") -include foo("d") -include foo("e") -include foo("f") -include foo("g") -include foo("h") -include foo("i") -include foo("j") -include foo("k") -include foo("l") -include foo("m") -include foo("n") -include foo("o") -include foo("p") -include foo("q") -include foo("r") -include foo("s") -include foo("t") -include foo("u") -include foo("v") -include foo("w") -include foo("x") -include foo("y") -include foo("z") diff --git a/lang/interpret_test/TestAstFunc2/slow-unification2.output b/lang/interpret_test/TestAstFunc2/slow-unification2.output deleted file mode 100644 index 3f2c99ec..00000000 --- a/lang/interpret_test/TestAstFunc2/slow-unification2.output +++ /dev/null @@ -1,6 +0,0 @@ -Vertex: print[/tmp/some-module-foo-flipflop] -Vertex: print[/tmp/some-module-foo] -Vertex: print[/tmp/some-module-hello world-flipflop] -Vertex: print[/tmp/some-module-hello world] -Vertex: print[/tmp/some-module-meep-flipflop] -Vertex: print[/tmp/some-module-meep] diff --git a/lang/interpret_test/TestAstFunc2/slow-unification2.txtar b/lang/interpret_test/TestAstFunc2/slow-unification2.txtar new file mode 100644 index 00000000..5e503322 --- /dev/null +++ b/lang/interpret_test/TestAstFunc2/slow-unification2.txtar @@ -0,0 +1,27 @@ +-- main.mcl -- +# reported by foxxx0 +import "classes.mcl" as baz +include baz.foo("hello world") +include baz.foo("meep") +include baz.foo("foo") +-- classes.mcl -- +import "datetime" +import "math" + +class foo($bar) { + $now = datetime.now() + print "/tmp/some-module-${bar}" { + msg => if datetime.weekday($now) == "friday" { "TGIF YAY!" } else { "meh..." }, + } + $x = math.mod($now, 2) + print "/tmp/some-module-${bar}-flipflop" { + msg => if $x == 0 { "FLIP" } else { "FLOP" }, + } +} +-- OUTPUT -- +Vertex: print[/tmp/some-module-foo-flipflop] +Vertex: print[/tmp/some-module-foo] +Vertex: print[/tmp/some-module-hello world-flipflop] +Vertex: print[/tmp/some-module-hello world] +Vertex: print[/tmp/some-module-meep-flipflop] +Vertex: print[/tmp/some-module-meep] diff --git a/lang/interpret_test/TestAstFunc2/slow-unification2/classes.mcl b/lang/interpret_test/TestAstFunc2/slow-unification2/classes.mcl deleted file mode 100644 index cf8a1d51..00000000 --- a/lang/interpret_test/TestAstFunc2/slow-unification2/classes.mcl +++ /dev/null @@ -1,13 +0,0 @@ -import "datetime" -import "math" - -class foo($bar) { - $now = datetime.now() - print "/tmp/some-module-${bar}" { - msg => if datetime.weekday($now) == "friday" { "TGIF YAY!" } else { "meh..." }, - } - $x = math.mod($now, 2) - print "/tmp/some-module-${bar}-flipflop" { - msg => if $x == 0 { "FLIP" } else { "FLOP" }, - } -} diff --git a/lang/interpret_test/TestAstFunc2/slow-unification2/main.mcl b/lang/interpret_test/TestAstFunc2/slow-unification2/main.mcl deleted file mode 100644 index 58c9a2f0..00000000 --- a/lang/interpret_test/TestAstFunc2/slow-unification2/main.mcl +++ /dev/null @@ -1,5 +0,0 @@ -# reported by foxxx0 -import "classes.mcl" as baz -include baz.foo("hello world") -include baz.foo("meep") -include baz.foo("foo") diff --git a/lang/interpret_test/TestAstFunc2/specific-simple-scoped-lambda.output b/lang/interpret_test/TestAstFunc2/specific-simple-scoped-lambda.output deleted file mode 100644 index 5a72b413..00000000 --- a/lang/interpret_test/TestAstFunc2/specific-simple-scoped-lambda.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[hello world] diff --git a/lang/interpret_test/TestAstFunc2/specific-simple-scoped-lambda/main.mcl b/lang/interpret_test/TestAstFunc2/specific-simple-scoped-lambda.txtar similarity index 77% rename from lang/interpret_test/TestAstFunc2/specific-simple-scoped-lambda/main.mcl rename to lang/interpret_test/TestAstFunc2/specific-simple-scoped-lambda.txtar index d3baa34f..3445f116 100644 --- a/lang/interpret_test/TestAstFunc2/specific-simple-scoped-lambda/main.mcl +++ b/lang/interpret_test/TestAstFunc2/specific-simple-scoped-lambda.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $funcgen = func() { func($b) { "hello world" @@ -9,3 +10,5 @@ $fn func(bool) str = $funcgen() $out = $fn(true) test $out {} +-- OUTPUT -- +Vertex: test[hello world] diff --git a/lang/interpret_test/TestAstFunc2/stack-overflow.output b/lang/interpret_test/TestAstFunc2/stack-overflow.output deleted file mode 100644 index 879ea314..00000000 --- a/lang/interpret_test/TestAstFunc2/stack-overflow.output +++ /dev/null @@ -1 +0,0 @@ -# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/stack-overflow/main.mcl b/lang/interpret_test/TestAstFunc2/stack-overflow.txtar similarity index 57% rename from lang/interpret_test/TestAstFunc2/stack-overflow/main.mcl rename to lang/interpret_test/TestAstFunc2/stack-overflow.txtar index 0c7e9291..25c9a2ef 100644 --- a/lang/interpret_test/TestAstFunc2/stack-overflow/main.mcl +++ b/lang/interpret_test/TestAstFunc2/stack-overflow.txtar @@ -1,3 +1,6 @@ +-- main.mcl -- # this should not compile, but previously once did! (woops) import "fmt" $x = fmt.printf("TEST is %s", if $x == "b" {"a"} else {"b"} ) +-- OUTPUT -- +# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-double.output b/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-double.output deleted file mode 100644 index 879ea314..00000000 --- a/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-double.output +++ /dev/null @@ -1 +0,0 @@ -# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-double/main.mcl b/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-double.txtar similarity index 84% rename from lang/interpret_test/TestAstFunc2/stmtfunc-recursive-double/main.mcl rename to lang/interpret_test/TestAstFunc2/stmtfunc-recursive-double.txtar index 16e0e8dd..9b962ead 100644 --- a/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-double/main.mcl +++ b/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-double.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # recursive function (not supported!) @@ -29,3 +30,5 @@ $out2 = sum2(-5) # -5 + -4 + -3 + -2 + -1 + -0 = -15 test fmt.printf("sum1(4) is %d", $out1) {} test fmt.printf("sum2(-5) is %d", $out2) {} +-- OUTPUT -- +# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-no-operators.output b/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-no-operators.output deleted file mode 100644 index 879ea314..00000000 --- a/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-no-operators.output +++ /dev/null @@ -1 +0,0 @@ -# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-no-operators/main.mcl b/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-no-operators.txtar similarity index 84% rename from lang/interpret_test/TestAstFunc2/stmtfunc-recursive-no-operators/main.mcl rename to lang/interpret_test/TestAstFunc2/stmtfunc-recursive-no-operators.txtar index 16e0e8dd..9b962ead 100644 --- a/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-no-operators/main.mcl +++ b/lang/interpret_test/TestAstFunc2/stmtfunc-recursive-no-operators.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # recursive function (not supported!) @@ -29,3 +30,5 @@ $out2 = sum2(-5) # -5 + -4 + -3 + -2 + -1 + -0 = -15 test fmt.printf("sum1(4) is %d", $out1) {} test fmt.printf("sum2(-5) is %d", $out2) {} +-- OUTPUT -- +# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/stmtfunc-recursive.output b/lang/interpret_test/TestAstFunc2/stmtfunc-recursive.output deleted file mode 100644 index 879ea314..00000000 --- a/lang/interpret_test/TestAstFunc2/stmtfunc-recursive.output +++ /dev/null @@ -1 +0,0 @@ -# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/stmtfunc-recursive/main.mcl b/lang/interpret_test/TestAstFunc2/stmtfunc-recursive.txtar similarity index 79% rename from lang/interpret_test/TestAstFunc2/stmtfunc-recursive/main.mcl rename to lang/interpret_test/TestAstFunc2/stmtfunc-recursive.txtar index 759ef480..0ca7ed74 100644 --- a/lang/interpret_test/TestAstFunc2/stmtfunc-recursive/main.mcl +++ b/lang/interpret_test/TestAstFunc2/stmtfunc-recursive.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "fmt" # recursive function (not supported!) @@ -18,3 +19,5 @@ $out2 = sum(-5) # -5 + -4 + -3 + -2 + -1 + -0 = -15 test fmt.printf("sum(4) is %d", $out1) {} test fmt.printf("sum(-5) is %d", $out2) {} +-- OUTPUT -- +# err: errSetScope: recursive reference while setting scope: not a dag diff --git a/lang/interpret_test/TestAstFunc2/stmtfunc-simple-args.output b/lang/interpret_test/TestAstFunc2/stmtfunc-simple-args.output deleted file mode 100644 index 5a72b413..00000000 --- a/lang/interpret_test/TestAstFunc2/stmtfunc-simple-args.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[hello world] diff --git a/lang/interpret_test/TestAstFunc2/stmtfunc-simple-args/main.mcl b/lang/interpret_test/TestAstFunc2/stmtfunc-simple-args.txtar similarity index 66% rename from lang/interpret_test/TestAstFunc2/stmtfunc-simple-args/main.mcl rename to lang/interpret_test/TestAstFunc2/stmtfunc-simple-args.txtar index b5b7781f..09900dca 100644 --- a/lang/interpret_test/TestAstFunc2/stmtfunc-simple-args/main.mcl +++ b/lang/interpret_test/TestAstFunc2/stmtfunc-simple-args.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # simple function definition func greeting($w) { "hello " + $w @@ -6,3 +7,5 @@ func greeting($w) { $out = greeting("world") test $out {} +-- OUTPUT -- +Vertex: test[hello world] diff --git a/lang/interpret_test/TestAstFunc2/stmtfunc-simple.output b/lang/interpret_test/TestAstFunc2/stmtfunc-simple.output deleted file mode 100644 index b7747cff..00000000 --- a/lang/interpret_test/TestAstFunc2/stmtfunc-simple.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[the answer is 42] diff --git a/lang/interpret_test/TestAstFunc2/stmtfunc-simple/main.mcl b/lang/interpret_test/TestAstFunc2/stmtfunc-simple.txtar similarity index 62% rename from lang/interpret_test/TestAstFunc2/stmtfunc-simple/main.mcl rename to lang/interpret_test/TestAstFunc2/stmtfunc-simple.txtar index 6d8504d9..922a72e3 100644 --- a/lang/interpret_test/TestAstFunc2/stmtfunc-simple/main.mcl +++ b/lang/interpret_test/TestAstFunc2/stmtfunc-simple.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- # simple function definition func answer() { "the answer is 42" @@ -6,3 +7,5 @@ func answer() { $out = answer() test $out {} +-- OUTPUT -- +Vertex: test[the answer is 42] diff --git a/lang/interpret_test/TestAstFunc2/struct-duplicate0.output b/lang/interpret_test/TestAstFunc2/struct-duplicate0.txtar similarity index 61% rename from lang/interpret_test/TestAstFunc2/struct-duplicate0.output rename to lang/interpret_test/TestAstFunc2/struct-duplicate0.txtar index ed49c2f0..7cff6dae 100644 --- a/lang/interpret_test/TestAstFunc2/struct-duplicate0.output +++ b/lang/interpret_test/TestAstFunc2/struct-duplicate0.txtar @@ -1 +1,4 @@ +-- main.mcl -- +$d []struct{x int;x int} +-- OUTPUT -- # err: errLexParse: parser: `syntax error: unexpected $end, expecting EQUALS` @1:6 diff --git a/lang/interpret_test/TestAstFunc2/struct-duplicate0/main.mcl b/lang/interpret_test/TestAstFunc2/struct-duplicate0/main.mcl deleted file mode 100644 index 71281ae3..00000000 --- a/lang/interpret_test/TestAstFunc2/struct-duplicate0/main.mcl +++ /dev/null @@ -1 +0,0 @@ -$d []struct{x int;x int} diff --git a/lang/interpret_test/TestAstFunc2/struct-duplicate1.output b/lang/interpret_test/TestAstFunc2/struct-duplicate1.txtar similarity index 64% rename from lang/interpret_test/TestAstFunc2/struct-duplicate1.output rename to lang/interpret_test/TestAstFunc2/struct-duplicate1.txtar index 7f529ffe..16bce64b 100644 --- a/lang/interpret_test/TestAstFunc2/struct-duplicate1.output +++ b/lang/interpret_test/TestAstFunc2/struct-duplicate1.txtar @@ -1 +1,4 @@ +-- main.mcl -- +$st struct{x int; x int} = struct{x => 0,} +-- OUTPUT -- # err: errLexParse: can't set return type in parser: `can't set return type in parser: duplicate struct field of `x int`` @1:24 diff --git a/lang/interpret_test/TestAstFunc2/struct-duplicate1/main.mcl b/lang/interpret_test/TestAstFunc2/struct-duplicate1/main.mcl deleted file mode 100644 index 3c697e79..00000000 --- a/lang/interpret_test/TestAstFunc2/struct-duplicate1/main.mcl +++ /dev/null @@ -1 +0,0 @@ -$st struct{x int; x int} = struct{x => 0,} diff --git a/lang/interpret_test/TestAstFunc2/struct-duplicate2.output b/lang/interpret_test/TestAstFunc2/struct-duplicate2.txtar similarity index 61% rename from lang/interpret_test/TestAstFunc2/struct-duplicate2.output rename to lang/interpret_test/TestAstFunc2/struct-duplicate2.txtar index 7f529ffe..61af923d 100644 --- a/lang/interpret_test/TestAstFunc2/struct-duplicate2.output +++ b/lang/interpret_test/TestAstFunc2/struct-duplicate2.txtar @@ -1 +1,4 @@ +-- main.mcl -- +$st struct{x int; x int} = struct{x => 0, x => 0,} +-- OUTPUT -- # err: errLexParse: can't set return type in parser: `can't set return type in parser: duplicate struct field of `x int`` @1:24 diff --git a/lang/interpret_test/TestAstFunc2/struct-duplicate2/main.mcl b/lang/interpret_test/TestAstFunc2/struct-duplicate2/main.mcl deleted file mode 100644 index 49c11139..00000000 --- a/lang/interpret_test/TestAstFunc2/struct-duplicate2/main.mcl +++ /dev/null @@ -1 +0,0 @@ -$st struct{x int; x int} = struct{x => 0, x => 0,} diff --git a/lang/interpret_test/TestAstFunc2/struct-duplicate3.output b/lang/interpret_test/TestAstFunc2/struct-duplicate3.output deleted file mode 100644 index da510087..00000000 --- a/lang/interpret_test/TestAstFunc2/struct-duplicate3.output +++ /dev/null @@ -1 +0,0 @@ -# err: errInit: duplicate struct field name of: `x` diff --git a/lang/interpret_test/TestAstFunc2/struct-duplicate3/main.mcl b/lang/interpret_test/TestAstFunc2/struct-duplicate3.txtar similarity index 52% rename from lang/interpret_test/TestAstFunc2/struct-duplicate3/main.mcl rename to lang/interpret_test/TestAstFunc2/struct-duplicate3.txtar index 6931f4c9..cf3f5c00 100644 --- a/lang/interpret_test/TestAstFunc2/struct-duplicate3/main.mcl +++ b/lang/interpret_test/TestAstFunc2/struct-duplicate3.txtar @@ -1,2 +1,5 @@ +-- main.mcl -- $st struct{x str} = struct{x => "hello", x => "world",} test structlookup($st, "x") {} +-- OUTPUT -- +# err: errInit: duplicate struct field name of: `x` diff --git a/lang/interpret_test/TestAstFunc2/struct-duplicate4.output b/lang/interpret_test/TestAstFunc2/struct-duplicate4.txtar similarity index 60% rename from lang/interpret_test/TestAstFunc2/struct-duplicate4.output rename to lang/interpret_test/TestAstFunc2/struct-duplicate4.txtar index ed49c2f0..f002a8cd 100644 --- a/lang/interpret_test/TestAstFunc2/struct-duplicate4.output +++ b/lang/interpret_test/TestAstFunc2/struct-duplicate4.txtar @@ -1 +1,4 @@ +-- main.mcl -- +$d []struct{x int;x float} +-- OUTPUT -- # err: errLexParse: parser: `syntax error: unexpected $end, expecting EQUALS` @1:6 diff --git a/lang/interpret_test/TestAstFunc2/struct-duplicate4/main.mcl b/lang/interpret_test/TestAstFunc2/struct-duplicate4/main.mcl deleted file mode 100644 index 7cc41f75..00000000 --- a/lang/interpret_test/TestAstFunc2/struct-duplicate4/main.mcl +++ /dev/null @@ -1 +0,0 @@ -$d []struct{x int;x float} diff --git a/lang/interpret_test/TestAstFunc2/structlookup0.output b/lang/interpret_test/TestAstFunc2/structlookup0.output deleted file mode 100644 index 2a905aff..00000000 --- a/lang/interpret_test/TestAstFunc2/structlookup0.output +++ /dev/null @@ -1,3 +0,0 @@ -Vertex: test[hello world] -Vertex: test[hello] -Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/structlookup0/main.mcl b/lang/interpret_test/TestAstFunc2/structlookup0.txtar similarity index 70% rename from lang/interpret_test/TestAstFunc2/structlookup0/main.mcl rename to lang/interpret_test/TestAstFunc2/structlookup0.txtar index 5b0c84bc..057f6c94 100644 --- a/lang/interpret_test/TestAstFunc2/structlookup0/main.mcl +++ b/lang/interpret_test/TestAstFunc2/structlookup0.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $st0 struct{x str} = struct{x => "hello",} test structlookup($st0, "x") {} @@ -6,3 +7,7 @@ test structlookup($st1, "y") {} $st2 = struct{x => true, y=> 42, z => "hello world",} test structlookup($st2, "z") {} +-- OUTPUT -- +Vertex: test[hello world] +Vertex: test[hello] +Vertex: test[world] diff --git a/lang/interpret_test/TestAstFunc2/structlookup1.output b/lang/interpret_test/TestAstFunc2/structlookup1.output deleted file mode 100644 index 0b63870b..00000000 --- a/lang/interpret_test/TestAstFunc2/structlookup1.output +++ /dev/null @@ -1,5 +0,0 @@ -Vertex: test[passed0a] -Vertex: test[passed0b] -Vertex: test[passed0c] -Vertex: test[passed1] -Vertex: test[passed2] diff --git a/lang/interpret_test/TestAstFunc2/structlookup1/main.mcl b/lang/interpret_test/TestAstFunc2/structlookup1.txtar similarity index 81% rename from lang/interpret_test/TestAstFunc2/structlookup1/main.mcl rename to lang/interpret_test/TestAstFunc2/structlookup1.txtar index 5adc98a8..0f889ab5 100644 --- a/lang/interpret_test/TestAstFunc2/structlookup1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/structlookup1.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- $st0 = struct{x1 => 1.0, x5 => 2.1, x15 => 3.2,} $s0a = if structlookup($st0, "x1") == 1.0 { "passed0a" @@ -33,3 +34,9 @@ $s2 = if structlookup($st2, "x5") == 2.1 { "failed" } test $s2 {} +-- OUTPUT -- +Vertex: test[passed0a] +Vertex: test[passed0b] +Vertex: test[passed0c] +Vertex: test[passed1] +Vertex: test[passed2] diff --git a/lang/interpret_test/TestAstFunc2/template-0.output b/lang/interpret_test/TestAstFunc2/template-0.output deleted file mode 100644 index fddc7367..00000000 --- a/lang/interpret_test/TestAstFunc2/template-0.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: print[template-0] diff --git a/lang/interpret_test/TestAstFunc2/template-0/main.mcl b/lang/interpret_test/TestAstFunc2/template-0.txtar similarity index 87% rename from lang/interpret_test/TestAstFunc2/template-0/main.mcl rename to lang/interpret_test/TestAstFunc2/template-0.txtar index f3e28249..d0ede1e7 100644 --- a/lang/interpret_test/TestAstFunc2/template-0/main.mcl +++ b/lang/interpret_test/TestAstFunc2/template-0.txtar @@ -1,3 +1,4 @@ +-- main.mcl -- import "datetime" $secplus42 = 42 + $ayear @@ -10,3 +11,5 @@ $tmplvalues = struct{time => $secplus42, hello => "world",} print "template-0" { msg => template("Hello: {{ .hello }}, 42 sec + 1 year is: {{ .time }} seconds, aka: {{ datetime_print .time }}", $tmplvalues), } +-- OUTPUT -- +Vertex: print[template-0] diff --git a/lang/interpret_test/TestAstFunc2/tricky-unification0.output b/lang/interpret_test/TestAstFunc2/tricky-unification0.output deleted file mode 100644 index 932f3fed..00000000 --- a/lang/interpret_test/TestAstFunc2/tricky-unification0.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[len is: 4] diff --git a/lang/interpret_test/TestAstFunc2/tricky-unification0/main.mcl b/lang/interpret_test/TestAstFunc2/tricky-unification0.txtar similarity index 64% rename from lang/interpret_test/TestAstFunc2/tricky-unification0/main.mcl rename to lang/interpret_test/TestAstFunc2/tricky-unification0.txtar index 8173619c..58b111b1 100644 --- a/lang/interpret_test/TestAstFunc2/tricky-unification0/main.mcl +++ b/lang/interpret_test/TestAstFunc2/tricky-unification0.txtar @@ -1,3 +1,6 @@ +-- main.mcl -- import "fmt" $ints = [13, 42, 0, -37,] test fmt.printf("len is: %d", len($ints)) {} # len is 4 +-- OUTPUT -- +Vertex: test[len is: 4] diff --git a/lang/interpret_test/TestAstFunc2/tricky-unification1.output b/lang/interpret_test/TestAstFunc2/tricky-unification1.output deleted file mode 100644 index 932f3fed..00000000 --- a/lang/interpret_test/TestAstFunc2/tricky-unification1.output +++ /dev/null @@ -1 +0,0 @@ -Vertex: test[len is: 4] diff --git a/lang/interpret_test/TestAstFunc2/tricky-unification1/main.mcl b/lang/interpret_test/TestAstFunc2/tricky-unification1.txtar similarity index 73% rename from lang/interpret_test/TestAstFunc2/tricky-unification1/main.mcl rename to lang/interpret_test/TestAstFunc2/tricky-unification1.txtar index 78aa4a8b..b004e6f4 100644 --- a/lang/interpret_test/TestAstFunc2/tricky-unification1/main.mcl +++ b/lang/interpret_test/TestAstFunc2/tricky-unification1.txtar @@ -1,4 +1,7 @@ +-- main.mcl -- import "fmt" $ints = [13, 42, 0, -37,] $l int = len($ints) # return type is known statically! test fmt.printf("len is: %d", $l) {} # len is 4 +-- OUTPUT -- +Vertex: test[len is: 4] diff --git a/misc/txtar-port.sh b/misc/txtar-port.sh new file mode 100644 index 00000000..b1902c97 --- /dev/null +++ b/misc/txtar-port.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# port tests to txtar +for f in */main.mcl; do + echo $f == $(dirname $f) + cat $f | cat - $(dirname $f).txtar | sponge $(dirname $f).txtar + echo '-- main.mcl --' | cat - $(dirname $f).txtar | sponge $(dirname $f).txtar +done