X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=blobdiff_plain;f=csrc%2Foceani-tests.mdc;h=182c77c8367b2e553c6619f410e2eee512a671cb;hp=fafb78821b76d5d1891cf1a630ad8896ef918a11;hb=d58f04dc62ec58ed72c00db43b80122fbdfc0925;hpb=631d5279eef7fe755d9df27ce16b416ba976154b diff --git a/csrc/oceani-tests.mdc b/csrc/oceani-tests.mdc index fafb788..182c77c 100644 --- a/csrc/oceani-tests.mdc +++ b/csrc/oceani-tests.mdc @@ -66,6 +66,12 @@ arguments separated from the name by commas. For each test, there is a section ./oceani --noexec --print .tmp.code1a >> .tmp.code2a || exit 1;\ if ! cmp -s .tmp.code1 .tmp.code2a; then \ echo " Failed"; diff -u .tmp.code1 .tmp.code2a; exit 1; fi ; \ + echo -n "brackets.. "; \ + echo '``````' > .tmp.code2b ; echo '``````' > .tmp.code2c ;\ + ./oceani --noexec --print --brackets .tmp.code1 >> .tmp.code2b || exit 1; \ + ./oceani -npb .tmp.code2b >> .tmp.code2c || exit 1 ; \ + if ! cmp -s .tmp.code2b .tmp.code2c; then \ + echo " Failed"; diff -u .tmp.code2b .tmp.code2c; exit 1; fi; \ echo -n "exec-after-print.. "; \ ./oceani .tmp.code1 $${1+"$$@"} > .tmp.have ; \ if ! cmp -s .tmp.want .tmp.have; then \ @@ -268,12 +274,12 @@ Now we need to test if/else and some different loops print "error is ", target - guess * guess for j:=0; then j = j+3 ; while j < 10: - if j != 0 and then 20 / j > 3: + if j != 0 and 20 / j > 3: print "20 /", j," =", 20 / j else print "I won't calculate 20 /", j pi ::= 3.1415926535897 - if 355/113 == pi or else +(pi - 355/113) < 0.001: + if 355/113 == pi or +(pi - 355/113) < 0.001: print "Close enough" print "lower" if 355/113 < pi else "higher" print "higher" if 355/113 > pi else "lower" @@ -775,7 +781,7 @@ A simple linked list example func insert(list:@linkage; new:string) p:=list - while ?p.next and then p.next.this < new: + while ?p.next and p.next.this < new: p = p.next.list t:@node = @new() t.list.next = p.next @@ -911,7 +917,7 @@ various places that `type_err()` are called. func main() print "hello" ++ 5, 5 ++ "hello" - + hello := "there"; print 4+hello b ::= 3 b = b + 1 @@ -922,6 +928,8 @@ various places that `type_err()` are called. ###### output: type_err1 .tmp.code:3:25: error: expected string found number .tmp.code:3:28: error: expected string found number + .tmp.code:4:34: error: expected number but variable 'hello' is string + .tmp.code:4:8: info: this is where 'hello' was set to string .tmp.code:6:8: error: Cannot assign to a constant: b .tmp.code:5:8: info: name was defined as a constant here .tmp.code:8:11: error: Arithmetic returns number but Boolean expected