]> git.kaiwu.me - njs.git/commitdiff
Added support for multiline tests.
authorDmitry Volyntsev <xeioex@nginx.com>
Tue, 29 Jan 2019 13:49:36 +0000 (16:49 +0300)
committerDmitry Volyntsev <xeioex@nginx.com>
Tue, 29 Jan 2019 13:49:36 +0000 (16:49 +0300)
njs/test/njs_interactive_test.c

index c5aa73d526161f509ad0da73be6c25db2d10f375..94d2a237aa11a225008322eceddef56a52166088 100644 (file)
@@ -17,7 +17,7 @@ typedef struct {
 } njs_interactive_test_t;
 
 
-#define ENTER "\n"
+#define ENTER "\n\3"
 
 
 static njs_interactive_test_t  njs_test[] =
@@ -276,12 +276,12 @@ njs_interactive_test(nxt_bool_t verbose)
         end = NULL;
 
         for ( ;; ) {
-            start = (end != NULL) ? end + 1 : start;
+            start = (end != NULL) ? end + nxt_length(ENTER) : start;
             if (start >= last) {
                 break;
             }
 
-            end = (u_char *) strchr((char *) start, '\n');
+            end = (u_char *) strstr((char *) start, ENTER);
 
             ret = njs_vm_compile(vm, &start, end);
             if (ret == NXT_OK) {