projects
/
project
/
firewall4.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1a94915
)
tests: mocklib: forward compatibility change
author
Jo-Philipp Wich
<jo@mein.io>
Fri, 11 Feb 2022 16:41:00 +0000
(17:41 +0100)
committer
Jo-Philipp Wich
<jo@mein.io>
Fri, 11 Feb 2022 16:41:00 +0000
(17:41 +0100)
Upstream ucode will change ord()'s return value type from array to integer,
add logic to handle both old and new cases.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
tests/lib/mocklib/uci.uc
patch
|
blob
|
history
diff --git
a/tests/lib/mocklib/uci.uc
b/tests/lib/mocklib/uci.uc
index 69d25615faaaee94c23e8e06cb9ea1ebc0f18715..ed6b610229cc5f105310193b46cadb4a421e0a31 100644
(file)
--- a/
tests/lib/mocklib/uci.uc
+++ b/
tests/lib/mocklib/uci.uc
@@
-1,11
+1,16
@@
{%
let mocklib = global.mocklib;
+ let byte = (str, off) => {
+ let v = ord(str, off);
+ return length(v) ? v[0] : v;
+ };
+
let hash = (s) => {
let h = 7;
for (let i = 0; i < length(s); i++)
- h = h * 31 +
ord(s, i)[0]
;
+ h = h * 31 +
byte(s, i)
;
return h;
};