summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-01-08 15:42:43 +0100
committerantirez <antirez@gmail.com>2016-01-08 15:44:21 +0100
commitf43c794b0b43b9134385a487e96bcd791bb0472a (patch)
tree3f0388264d59f0661e4f4600e8e072ebdadc1520 /tests
parente15e518a674ce75ada1badb3e4fe11c18c255016 (diff)
downloadredis-f43c794b0b43b9134385a487e96bcd791bb0472a.tar.gz
Scripting: handle trailing comments.
This fix, provided by Paul Kulchenko (@pkulchenko), allows the Lua scripting engine to evaluate statements with a trailing comment like the following one: EVAL "print() --comment" 0 Lua can't parse the above if the string does not end with a newline, so now a final newline is always added automatically. This does not change the SHA1 of scripts since the SHA1 is computed on the body we pass to EVAL, without the other code we add to register the function. Close #2951.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/scripting.tcl4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/unit/scripting.tcl b/tests/unit/scripting.tcl
index d515c3a51..0efe86ad6 100644
--- a/tests/unit/scripting.tcl
+++ b/tests/unit/scripting.tcl
@@ -272,6 +272,10 @@ start_server {tags {"scripting"}} {
} 0
} {}
+ test {EVAL - Able to parse trailing comments} {
+ r eval {return 'hello' --trailing comment} 0
+ } {hello}
+
test {SCRIPTING FLUSH - is able to clear the scripts cache?} {
r set mykey myval
set v [r evalsha fd758d1589d044dd850a6f05d52f2eefd27f033f 1 mykey]