]> ocean-lang.org Git - ocean/blobdiff - csrc/scanner-tests.mdc
oceani: simplify test in var_block_close.
[ocean] / csrc / scanner-tests.mdc
index 7858e1d51f9c43048dd35d2b2c5ef08e187f6656..776b2533f98046109af0e8cc8938a33a67379ca5 100644 (file)
@@ -33,12 +33,12 @@ about each test.
                done
 
                ## other tests
-
+               @for i in coverage/#*.gcda; do mv $$i coverage/$${i##*#}; done
                @gcov -o coverage scanner.c libscanner.c > /dev/null 2> /dev/null
                @mv *.gcov coverage; [ -f .gcov ] && mv .gcov coverage || true
                @awk '/NOTEST/ { next } /^ *[1-9]/ {ran+=1} /^ *###/ {skip+=1} \
                    END {printf "coverage: %6.2f%%\n", ran * 100 / (ran + skip); \
-                        if (ran < (ran + skip) *0.92) exit(1) }' \
+                        if (ran < (ran + skip) *0.94) exit(1) }' \
                        coverage/scanner.mdc.gcov
                @rm -f .tmp*
 
@@ -53,12 +53,12 @@ Some simple tests... maybe all tests are simple.
 Include a special test for numbers, as they are interesting.
 
 ###### test list
-       scanner_tests += "test1,if,then,+,-"
-       scanner_tests += "test1,if,then,+,-,/"
-       scanner_tests += "test1,--ignore-indent,if,then,+,-,/"
+       scanner_tests += "test1,-r,if,then,+,-"
+       scanner_tests += "test1,-r,if,then,+,-,/"
+       scanner_tests += "test1,-r,--ignore-indent,if,then,+,-,/"
+       scanner_tests += "test1,-r,--ignore-indent,--ignore-newline,if,then,+,-,/"
        scanner_tests += "test1,--ignore-indent,--ignore-newline,if,then,+,-,/"
-       scanner_tests += "test1,-Cc,--ignore-indent,--ignore-newline,if,then,+,-,/"
-       scanner_tests += "test1,-CcSz,--ignore-indent,--ignore-newline,if,then,+,-,/"
+       scanner_tests += "test1,-Sz,--ignore-indent,--ignore-newline,if,then,+,-,/"
 
 ###### test: test1
 
@@ -93,7 +93,7 @@ Include a special test for numbers, as they are interesting.
        lines */
        divident /+ divisor
 
-###### output: test1,if,then,+,-
+###### output: test1,-r,if,then,+,-
        Tokenizing: 
        2:0 ident(A)
        2:2 ident(B)
@@ -180,7 +180,7 @@ Include a special test for numbers, as they are interesting.
        32:0 newline()
        32:0 eof()
 
-###### output: test1,if,then,+,-,/
+###### output: test1,-r,if,then,+,-,/
        Tokenizing: 
        2:0 ident(A)
        2:2 ident(B)
@@ -268,7 +268,7 @@ Include a special test for numbers, as they are interesting.
        32:0 newline()
        32:0 eof()
 
-###### output: test1,--ignore-indent,if,then,+,-,/
+###### output: test1,-r,--ignore-indent,if,then,+,-,/
        Tokenizing: 
        2:0 ident(A)
        2:2 ident(B)
@@ -344,7 +344,7 @@ Include a special test for numbers, as they are interesting.
        31:19 newline()
        32:0 eof()
 
-###### output: test1,--ignore-indent,--ignore-newline,if,then,+,-,/
+###### output: test1,-r,--ignore-indent,--ignore-newline,if,then,+,-,/
        Tokenizing: 
        2:0 ident(A)
        2:2 ident(B)
@@ -396,7 +396,7 @@ Include a special test for numbers, as they are interesting.
        31:12 ident(divisor)
        32:0 eof()
 
-###### output: test1,-Cc,--ignore-indent,--ignore-newline,if,then,+,-,/
+###### output: test1,--ignore-indent,--ignore-newline,if,then,+,-,/
        Tokenizing: 
        2:0 ident(A)
        2:2 ident(B)
@@ -445,7 +445,7 @@ Include a special test for numbers, as they are interesting.
        31:12 ident(divisor)
        32:0 eof()
 
-###### output: test1,-CcSz,--ignore-indent,--ignore-newline,if,then,+,-,/
+###### output: test1,-Sz,--ignore-indent,--ignore-newline,if,then,+,-,/
        Tokenizing: 
        2:0 ident(A)
        2:2 ident(B)
@@ -607,8 +607,8 @@ Now to test for some errors ... though things I thought would be errors
 sometimes aren't.
 
 ###### test list
-       scanner_tests += "errtest,--ignore-ident,--ignore-mark,-W_,-w_,if,then,+,-"
-       scanner_tests += "errtest,--ignore-ident,--ignore-mark,-N,if,then,+,-"
+       scanner_tests += "errtest,-r,--ignore-ident,--ignore-mark,-W_,-w_,if,then,+,-"
+       scanner_tests += "errtest,-r,--ignore-ident,--ignore-mark,-N,if,then,+,-"
 
 ###### test: errtest
 
@@ -626,7 +626,7 @@ sometimes aren't.
 
        "  \\ \t \n special chars in strings"
 
-###### output: errtest,--ignore-ident,--ignore-mark,-W_,-w_,if,then,+,-
+###### output: errtest,-r,--ignore-ident,--ignore-mark,-W_,-w_,if,then,+,-
 
        Tokenizing: 
        2:0 ERROR(multiple)
@@ -664,7 +664,7 @@ sometimes aren't.
        15:0 newline()
        15:0 eof()
 
-###### output: errtest,--ignore-ident,--ignore-mark,-N,if,then,+,-
+###### output: errtest,-r,--ignore-ident,--ignore-mark,-N,if,then,+,-
        Tokenizing: 
        2:0 ERROR(multiple)
        2:9 ERROR(decimal)
@@ -742,7 +742,7 @@ to one.
        done
 
 ###### test list
-       scanner_section_tests += section1
+       scanner_section_tests += section1 section_string section_comment
 
 ###### test: section1
 
@@ -778,6 +778,60 @@ to one.
        4:0 newline()
        4:0 eof()
 
+###### test: section_string
+       a = '''
+         A sting mustn't cross
+         ## string B
+       skip
+
+###### string B
+       to a new node
+       '''
+
+###### output: section_string
+       Tokenizing: test: section_string
+       1:8 ident(a)
+       1:10 mark(=)
+       1:12 ERROR('''\x0a\x09  A sting mus..)
+       7:8 in()
+       7:8 ident(to)
+       7:11 ident(a)
+       7:13 ident(new)
+       7:17 ident(node)
+       8:8 newline()
+       8:8 ERROR(''')
+       4:8 newline()
+       4:8 out()
+       4:8 newline()
+       4:8 ident(skip)
+       5:0 newline()
+       5:0 eof()
+
+###### test: section_comment
+       /* Mult-line comment must stay within
+       ## comment B
+       */
+
+###### comment B
+       a single node, they cannot cross nodes.
+
+###### output: section_comment
+       Tokenizing: test: section_comment
+       1:8 ERROR(/* Mult-line comme..)
+       6:8 ident(a)
+       6:10 ident(single)
+       6:17 ident(node)
+       6:21 mark(,)
+       6:23 ident(they)
+       6:28 ident(cannot)
+       6:35 ident(cross)
+       6:41 ident(nodes)
+       6:46 mark(.)
+       3:8 newline()
+       3:8 mark(*/)
+       4:0 newline()
+       4:0 eof()
+
 ## Ad-hoc test
 
 These tests test bugs that were found in practice, and so prevent them recuring.