]> ocean-lang.org Git - ocean/blobdiff - csrc/oceani-tests.mdc
oceani: allow 'then' in simple if statements.
[ocean] / csrc / oceani-tests.mdc
index 5366bf92ddf60e1045c5b0ed3a9bc6bee6cc560f..ab89bf27ccd52140f8b43a4a72c0ecf18d6d8ec0 100644 (file)
@@ -57,6 +57,13 @@ arguments separated from the name by commas.  For each test, there is a section
                    ./oceani --noexec --print .tmp.code1 >> .tmp.code2 ;\
                    if ! cmp -s .tmp.code1 .tmp.code2; then \
                       echo " Failed"; diff -u .tmp.code1 .tmp.code2; exit 1 ; fi ; \
+                   echo -n "extra-newlines.. "; \
+                   sed -e 'i\
+                   ' .tmp.code1 > .tmp.code1a; \
+                   echo '``````' > .tmp.code2a ;\
+                   ./oceani --noexec --print .tmp.code1a >> .tmp.code2a;\
+                   if ! cmp -s .tmp.code1 .tmp.code2a; then \
+                      echo " Failed"; diff -u .tmp.code1 .tmp.code2a; exit 1; fi ; \
                    echo -n "exec-after-print.. "; \
                    ./oceani .tmp.code1 $${1+"$$@"} > .tmp.have ; \
                    if ! cmp -s .tmp.want .tmp.have; then \
@@ -235,6 +242,16 @@ Now we need to test if/else and some different loops
                        print "Close enough"
                print "lower" if 355/113 < pi else "higher"
 
+               if pi > 3 then print "pi exceeds three"; else print "need more pie"
+               if (pi < 3) { print "not enough pi" } else { print "pi sufficient" }
+               for { i := 0; sum := 0 }
+               then { i = i+1 }
+               while i <= 10:
+                       sum = sum + i
+               else:
+                       pass
+                       print "sum 1..10 is", sum
+
 ###### output: cond_loop
        Success
         1 2 4 8 16 32 64
@@ -249,6 +266,9 @@ Now we need to test if/else and some different loops
        I won't calculate 20 / 9
        Close enough
        higher
+       pi exceeds three
+       pi sufficient
+       sum 1..10 is 55
 
 ## Say Hello
 
@@ -793,7 +813,7 @@ various places that `type_err()` are called.
 
 ###### output: type_err_const1
        .tmp.code:3:12: Syntax error in constant: :
-       .tmp.code:4:8: Syntax error in constant: bar
+       .tmp.code:4:12: Syntax error in constant: :
 
 ## Test erroneous command line args