Welcome! Log In Create A New Profile

Advanced

[njs] Improved expect tests.

Dmitry Volyntsev
May 07, 2019 12:52PM
details: https://hg.nginx.org/njs/rev/a7a632e7d686
branches:
changeset: 954:a7a632e7d686
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Tue May 07 19:50:35 2019 +0300
description:
Improved expect tests.

diffstat:

auto/expect | 3 ++-
njs/test/inputrc | 5 +++++
njs/test/njs_expect_test.exp | 44 ++++++++++++++++++++++++++++++--------------
3 files changed, 37 insertions(+), 15 deletions(-)

diffs (154 lines):

diff -r a84f514e864d -r a7a632e7d686 auto/expect
--- a/auto/expect Mon May 06 05:40:03 2019 +0300
+++ b/auto/expect Tue May 07 19:50:35 2019 +0300
@@ -21,7 +21,8 @@ if [ $nxt_found = yes -a $NXT_HAVE_READL
cat << END >> $NXT_MAKEFILE

njs_expect_test: njs njs/test/njs_expect_test.exp
- PATH=$NXT_BUILD_DIR:\$(PATH) expect -f njs/test/njs_expect_test.exp
+ INPUTRC=njs/test/inputrc PATH=$NXT_BUILD_DIR:\$(PATH) \
+ expect -f njs/test/njs_expect_test.exp
END

else
diff -r a84f514e864d -r a7a632e7d686 njs/test/inputrc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/njs/test/inputrc Tue May 07 19:50:35 2019 +0300
@@ -0,0 +1,5 @@
+set bell-style audible
+set print-completions-horizontally on
+set completion-display-width 0
+set completion-ignore-case on
+set page-completions off
diff -r a84f514e864d -r a7a632e7d686 njs/test/njs_expect_test.exp
--- a/njs/test/njs_expect_test.exp Mon May 06 05:40:03 2019 +0300
+++ b/njs/test/njs_expect_test.exp Tue May 07 19:50:35 2019 +0300
@@ -12,6 +12,18 @@ proc njs_test {body {opts ""}} {
eval spawn -nottycopy njs $opts
}

+ # TODO:
+ # SIGINT handling race condition
+ # deb9-amd64-generic-njs-try
+ # ub1404-armv7-generic-njs-try
+ # ub1804-arm64-generic-njs-try
+ # UTF8 terminal support issue
+ # sol11-amd64-sunpro-njs-try
+ # ub1604-arm64-generic-njs-try
+
+ # set timeout 30
+ # expect_before timeout { exit 1 }
+
expect -re "interactive njs \\d+\.\\d+\.\\d+\r\n\r"
expect "v.<Tab> -> the properties and prototype methods of v.\r
type console.help() for more information\r
@@ -33,7 +45,6 @@ type console.help() for more information
proc njs_run {opts output} {
eval spawn -nottycopy njs $opts
expect -re $output
- expect eof
}

njs_test {
@@ -41,7 +52,7 @@ njs_test {
"njs.version\r\n\*\.\*\.\*"}
}

-# simple multi line interation
+# simple multi line interaction
njs_test {
{"var a = 1\r\n"
"var a = 1\r\nundefined\r\n>> "}
@@ -62,30 +73,33 @@ njs_test {
}

# Global completions, single partial match
+
+# \a* is WORKAROUND for libedit-20170329.3.1-r3
+# which inserts '\rESC[6G' after '\a'.
njs_test {
{"O\t"
- "O\abject"}
+ "O\a*bject"}
}

njs_test {
{"Ma\t"
- "Ma\ath"}
+ "Ma\a*th"}
}

njs_test {
{"conso\t"
- "conso\ale"}
+ "conso\a*le"}
}

# Global completions, multiple partial match
njs_test {
{"cons\t\t"
- "console*console.help*console.time*const"}
+ "console*const"}
}

njs_test {
{"O\t"
- "O\abject"}
+ "O\a*bject"}
{".\t\t"
"Object.create*Object.isSealed"}
}
@@ -97,16 +111,16 @@ njs_test {

njs_test {
{"Object.g\t"
- "Object.g\aet"}
- {"\t"
+ "Object.g\a*et"}
+ {"\t\t"
"Object.getOwnPropertyDescriptor*Object.getPrototypeOf"}
}

njs_test {
{"Ma\t"
- "Ma\ath"}
+ "Ma\a*th"}
{".\t\t"
- "Math.__proto__*Math.cbrt*Math.fround*Math.log2"}
+ "Math.abs*Math.atan2"}
}

# Global completions, no matches
@@ -133,11 +147,13 @@ njs_test {
"a*aa*arguments*await"}
}

+# z*z is WORKAROUND for libedit-20170329.3.1-r3
+# which inserts bogus '\a' between 'z'
njs_test {
{"var zz = 1\r\n"
"var zz = 1\r\nundefined\r\n>> "}
{"1 + z\t\r\n"
- "1 + zz\r\n2"}
+ "1 + z*z*\r\n2"}
}

njs_test {
@@ -375,7 +391,7 @@ njs_test {
{"var fs = require('fs')\r\n"
"undefined\r\n>> "}
{"fs.read\t"
- "fs.read\aFile"}
+ "fs.read\a*File"}
}

# require('fs').readFile()
@@ -641,7 +657,7 @@ njs_run "-v" "\\d+\.\\d+\.\\d+"

njs_test {
{"1+1\r\n"
- "00000 ADD*\r\n00040 STOP*\r\n\r\n2"}
+ "00000 ADD*\r\n*2"}
{"for (var n in [1]) {try {break} finally{}}\r\n"
"00000 ARRAY*\r\n*TRY BREAK*STOP*\r\n\r\nundefined"}
{"(function() {try {return} finally{}})()\r\n"
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Improved expect tests.

Dmitry Volyntsev 316 May 07, 2019 12:52PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 310
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready