]> ocean-lang.org Git - ocean/blobdiff - csrc/oceani-tests.mdc
oceani: add test for duplicate main functions
[ocean] / csrc / oceani-tests.mdc
index 881fee7229e7642869bca66b3cc79c9d808ad63d..7be2d2502b1e99deed67e58830498a7b984404b5 100644 (file)
@@ -824,12 +824,20 @@ various places that `type_err()` are called.
                foo := 4
                print foo, bar
 
+       // trigger duplicate-main error
+       func main()
+               foo := 6
+               print bar, foo
+
 ###### output: type_err_const
        .tmp.code:4:16: error: expected number found string
        .tmp.code:6:8: error: name already declared: bar
        .tmp.code:4:8: info: this is where 'bar' was first declared
        .tmp.code:8:8: error: variable 'foo' redeclared
        .tmp.code:3:8: info: this is where 'foo' was first declared
+       .tmp.code:13:8: error: variable 'foo' redeclared
+       .tmp.code:3:8: info: this is where 'foo' was first declared
+       .tmp.code:13:8: "main" defined a second time
 
 ###### test: type_err_const1
        const