Welcome! Log In Create A New Profile

Advanced

[njs] Tests: removed njs specific code from js_shared_dict.t.

Anonymous User
October 30, 2024 07:56PM
details: https://github.com/nginx/njs/commit/0ed2de6eb26ef473b9d69ed5eaba00849c6e0168
branches: master
commit: 0ed2de6eb26ef473b9d69ed5eaba00849c6e0168
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Mon, 28 Oct 2024 17:08:40 -0700
description:
Tests: removed njs specific code from js_shared_dict.t.


---
nginx/t/js_shared_dict.t | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/nginx/t/js_shared_dict.t b/nginx/t/js_shared_dict.t
index 16128225..ae3321d7 100644
--- a/nginx/t/js_shared_dict.t
+++ b/nginx/t/js_shared_dict.t
@@ -237,7 +237,8 @@ $t->write_file('test.js', <<'EOF');
ks = ngx.shared[r.args.dict].keys();
}

- r.return(200, `[${ks.toSorted()}]`);
+ var sorted = ks.toSorted();
+ r.return(200, (sorted.length) ? sorted.join(",") : "empty");
}

function items(r) {
@@ -250,7 +251,7 @@ $t->write_file('test.js', <<'EOF');
kvs = ngx.shared[r.args.dict].items();
}

- r.return(200, njs.dump(kvs.toSorted()));
+ r.return(200, kvs.toSorted().join("|"));
}

function name(r) {
@@ -350,8 +351,8 @@ like(http_get('/has?dict=waka&key=FOO'), qr/true/, 'has waka.FOO');

$t->reload();

-like(http_get('/keys?dict=foo'), qr/\[FOO\,FOO2\,FOO3]/, 'foo keys');
-like(http_get('/keys?dict=foo&max=2'), qr/\[FOO\,FOO3]/, 'foo keys max 2');
+like(http_get('/keys?dict=foo'), qr/FOO\,FOO2\,FOO3/, 'foo keys');
+like(http_get('/keys?dict=foo&max=2'), qr/FOO\,FOO3/, 'foo keys max 2');
like(http_get('/size?dict=foo'), qr/size: 3/, 'no of items in foo');
like(http_get('/get?dict=foo&key=FOO2'), qr/yyy/, 'get foo.FOO2');
like(http_get('/get?dict=bar&key=FOO'), qr/zzz/, 'get bar.FOO');
@@ -373,14 +374,14 @@ like(http_get('/pop?dict=foo&key=FOO'), qr/undefined/, 'pop expired foo.FOO');
TODO: {
local $TODO = 'not yet' unless has_version('0.8.1');

-like(http_get('/keys?dict=foo'), qr/\[]/, 'foo keys after expire');
-like(http_get('/keys?dict=bar'), qr/\[FOO\,FOO2]/, 'bar keys after a delay');
+like(http_get('/keys?dict=foo'), qr/empty/, 'foo keys after expire');
+like(http_get('/keys?dict=bar'), qr/FOO\,FOO2/, 'bar keys after a delay');
like(http_get('/size?dict=foo'), qr/size: 0/,
'no of items in foo after expire');
-like(http_get('/items?dict=bar'), qr/\[\['FOO','zzz'],\['FOO2','aaa']]/,
+like(http_get('/items?dict=bar'), qr/FOO,zzz|FOO2,aaa/,
'bar items');
-like(http_get('/items?dict=waka'),
- qr/\[\['FOO',47],\['FOO2',7779],\['FOO3',3338]]/, 'waka items');
+like(http_get('/items?dict=waka'), qr/FOO,47|FOO2,7779|FOO3,3338/,
+ 'waka items');

}

@@ -401,7 +402,7 @@ like(http_get('/add?dict=waka&key=FOO2&value=42&timeout=1000'), qr/true/,
like(http_get('/incr?dict=waka&key=FOO3&by=42&timeout=1000'), qr/42/,
'incr waka.FOO3');

-like(http_get('/keys?dict=waka'), qr/\[FOO\,FOO2\,FOO3]/, 'waka keys');
+like(http_get('/keys?dict=waka'), qr/FOO\,FOO2\,FOO3/, 'waka keys');

}

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Tests: removed njs specific code from js_shared_dict.t.

Anonymous User 150 October 30, 2024 07:56PM



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

Online Users

Guests: 133
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready