[njs] Added support for multiline tests.

Dmitry Volyntsev xeioex at nginx.com
Tue Jan 29 15:15:21 UTC 2019


details:   https://hg.nginx.org/njs/rev/ef39ae753b9e
branches:  
changeset: 740:ef39ae753b9e
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Tue Jan 29 16:49:36 2019 +0300
description:
Added support for multiline tests.

diffstat:

 njs/test/njs_interactive_test.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r b4b1280ae790 -r ef39ae753b9e njs/test/njs_interactive_test.c
--- a/njs/test/njs_interactive_test.c	Sun Jan 27 05:21:32 2019 +0800
+++ b/njs/test/njs_interactive_test.c	Tue Jan 29 16:49:36 2019 +0300
@@ -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) {


More information about the nginx-devel mailing list