]> ocean-lang.org Git - ocean/commitdiff
indent_test: make testing easier - and include expected output
authorNeilBrown <neil@brown.name>
Sat, 15 Jun 2019 23:17:58 +0000 (09:17 +1000)
committerNeilBrown <neil@brown.name>
Sat, 15 Jun 2019 23:17:58 +0000 (09:17 +1000)
Signed-off-by: NeilBrown <neil@brown.name>
csrc/indent_test.mdc

index 540ecd22584868f832ac6b505b48b8088464ed0d..d8e945ec3dab627994bb91492c080aac1d56b1a9 100644 (file)
@@ -16,8 +16,13 @@ with complete bracketing and indenting.
                ./md2c indent_test.mdc
        itest: itest.c
 
-       demos:: itest itest.code
+       doitest: itest itest.code
                ./itest itest.code
+       checkitest: itest itest.code
+               @grep -v '^#' itest.out > .tmp.out
+               @./itest itest.code | diff -u - .tmp.out || echo itest FAILED
+       demos :: doitest
+       tests :: checkitest
 
 # indent: header
 
@@ -283,3 +288,36 @@ $*expression
                        c= d
        x = y
 
+# File: itest.out
+       (hello=yes);
+       (mister=no);
+       (there=x);
+       (all=y);
+       if (cond+cond2):
+           (hello=x);
+           (hello2=x);
+           (sum=(val+val));
+           if condX:
+               (foo=((x*x)+(y/two)));
+       else:
+           if cond2:
+               (there1=x);
+               (there1a=x);
+       (there2=x);
+       (there3=x);
+       (all=y);
+       if true:
+           (yes=x);
+       else:
+           (no=x);
+       if true:
+           (yes=no);
+           (no=yes);
+       if false:
+           (print=OK);
+       else:
+           (print=not_OK);
+       if a:
+           if b:
+               (c=d);
+       (x=y);