[njs] Test262: simplified import_chain.t.js.

Dmitry Volyntsev xeioex at nginx.com
Thu Feb 8 01:57:55 UTC 2024


details:   https://hg.nginx.org/njs/rev/82ae061db9d0
branches:  
changeset: 2285:82ae061db9d0
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed Feb 07 17:57:01 2024 -0800
description:
Test262: simplified import_chain.t.js.

Avoid using "crypto" module, which unnessesary complicates the test.

diffstat:

 test/js/import_chain.t.js   |  8 ++------
 test/js/module/libs/hash.js |  5 +----
 test/js/module/sub/sub1.js  |  3 +--
 3 files changed, 4 insertions(+), 12 deletions(-)

diffs (49 lines):

diff -r 45f72ce8761b -r 82ae061db9d0 test/js/import_chain.t.js
--- a/test/js/import_chain.t.js	Wed Feb 07 17:57:01 2024 -0800
+++ b/test/js/import_chain.t.js	Wed Feb 07 17:57:01 2024 -0800
@@ -4,10 +4,6 @@ flags: []
 paths: [test/js/module/, test/js/module/libs/, test/js/module/sub]
 ---*/
 
-import lib2   from 'lib2.js';
+import lib2 from 'lib2.js';
 
-import crypto from 'crypto';
-var h = crypto.createHash('md5');
-var hash = h.update('AB').digest('hex');
-
-assert.sameValue(lib2.hash(), hash);
+assert.sameValue(lib2.hash(), "XXX");
diff -r 45f72ce8761b -r 82ae061db9d0 test/js/module/libs/hash.js
--- a/test/js/module/libs/hash.js	Wed Feb 07 17:57:01 2024 -0800
+++ b/test/js/module/libs/hash.js	Wed Feb 07 17:57:01 2024 -0800
@@ -1,11 +1,8 @@
 function hash() {
-    var h = crypto.createHash('md5');
-    var v = h.update('AB').digest('hex');
-    return v;
+    return "XXX";
 }
 
 import sub from 'sub/sub3.js';
 import name from 'name.js';
-import crypto from 'crypto';
 
 export default {hash, name};
diff -r 45f72ce8761b -r 82ae061db9d0 test/js/module/sub/sub1.js
--- a/test/js/module/sub/sub1.js	Wed Feb 07 17:57:01 2024 -0800
+++ b/test/js/module/sub/sub1.js	Wed Feb 07 17:57:01 2024 -0800
@@ -1,5 +1,5 @@
 function hash() {
-    return sub2.hash(crypto);
+    return sub2.hash();
 }
 
 function error() {
@@ -7,6 +7,5 @@ function error() {
 }
 
 import sub2 from 'sub2.js';
-import crypto from 'crypto';
 
 export default {hash, error};


More information about the nginx-devel mailing list