]> ocean-lang.org Git - ocean/blobdiff - csrc/oceani-tests.mdc
oceani: allow global constants to be used before declared.
[ocean] / csrc / oceani-tests.mdc
index 359c8e504675d0dc36ceed1f4a0f880da8130d26..c13a9d173a5f0d876a500791f05fe2630023f073 100644 (file)
@@ -167,6 +167,7 @@ Now some contants
 
 ###### test: consts
        const
+               tau ::= pi * 2
                pi ::= 3.141 592 653
                four ::= 2 + 2 ; five ::= 10/2
        const pie ::= "I like Pie";
@@ -176,12 +177,12 @@ Now some contants
        func main()
                print "Hello World, what lovely oceans you have!"
                print "are there", five, "?"
-               print pi, pie, "but", cake
+               print pi, pie, "but", cake, "Tau is", tau
 
 ###### output: consts
        Hello World, what lovely oceans you have!
        are there 5 ?
-       3.141592653 I like Pie but The cake is a lie
+       3.141592653 I like Pie but The cake is a lie Tau is 6.283185306
 
 Test merging of variables from multiple cases
 
@@ -921,7 +922,7 @@ various places that `type_err()` are called.
        oceani: type error in program - not running.
 
 ###### test list
-       oceani_failing_tests += type_err_const type_err_const1 missing_program bad_main
+       oceani_failing_tests += type_err_const type_err_const1 type_err_const2 missing_program bad_main
 
 ###### test: type_err_const
        const
@@ -961,6 +962,15 @@ various places that `type_err()` are called.
        .tmp.code:3:12: Syntax error in constant: :
        .tmp.code:4:12: Syntax error in constant: :
 
+###### test: type_err_const2
+       const
+               four ::= two + two
+               two ::= four / 2
+       
+###### output: type_err_const2
+       .tmp.code:3:8: error: const four cannot be resolved.
+       .tmp.code:4:8: error: const two cannot be resolved.
+
 ###### test: missing_program
        const
                foo::="bar"