]> ocean-lang.org Git - ocean/commitdiff
scanner: hide impossible code from coverage testing.
authorNeilBrown <neil@brown.name>
Sun, 9 Jun 2019 00:03:44 +0000 (10:03 +1000)
committerNeilBrown <neil@brown.name>
Sun, 9 Jun 2019 00:11:03 +0000 (10:11 +1000)
The code in "white space" section is truly impossible, as
we don't return WEOF untile ->node is NULL, and when that
happens, ->col is set to 0.

Other code is only "mostly dead".

This brings coverage to 95%

Signed-off-by: NeilBrown <neil@brown.name>
csrc/scanner-tests.mdc
csrc/scanner.mdc

index 6a81989880b9415dd866ddc6d4252fd02c6ee455..ec34812d0cf9313c847364e7e86805425e786553 100644 (file)
@@ -38,7 +38,7 @@ about each test.
                @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.94) exit(1) }' \
+                        if (ran < (ran + skip) *0.95) exit(1) }' \
                        coverage/scanner.mdc.gcov
                @rm -f .tmp*
 
index 777688482566796691d97f6df6cd3e8e5cf9e863..fcfadca97c7803ede6422d5bc6e06493691f58d3 100644 (file)
@@ -882,11 +882,6 @@ tokens will continue to return the same end-of-file token.
 
 ###### white space
        if (ch == WEOF) {
-               if (state->col) {
-                       state->col = 0;
-                       state->check_indent = 1;
-                       continue;
-               }
                tk.num = TK_eof;
                return tk;
        }
@@ -1005,12 +1000,12 @@ a flag that tells us whether or not we need to strip.
                            &mbstate);
                if (n == -2 || n == 0) {
                        /* Not enough bytes - not really possible */
-                       next = '\n';
-                       state->offset = state->node->code.len;
+                       next = '\n';                            // NOTEST
+                       state->offset = state->node->code.len;  // NOTEST
                } else if (n == -1) {
                        /* error */
-                       state->offset += 1;
-                       next = 0x7f; // an illegal character
+                       state->offset += 1;                     // NOTEST
+                       next = 0x7f; // an illegal character    // NOTEST
                } else
                        state->offset += n;