Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
3cd4ad26
Commit
3cd4ad26
authored
Apr 13, 2012
by
antirez
Browse files
Tests modified to match the new global protection implementation.
parent
d86c4a7b
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/unit/scripting.tcl
View file @
3cd4ad26
...
@@ -223,39 +223,12 @@ start_server {tags {"scripting"}} {
...
@@ -223,39 +223,12 @@ start_server {tags {"scripting"}} {
test
{
Globals protection reading an undeclared global variable
}
{
test
{
Globals protection reading an undeclared global variable
}
{
catch
{
r eval
{
return a
}
0
}
e
catch
{
r eval
{
return a
}
0
}
e
set e
set e
}
{
*ERR*
global variable*not declared
*
}
}
{
*ERR*
attempted to access unexisting global
*
}
test
{
Globals protection setting an undeclared global
variable
}
{
test
{
Globals protection setting an undeclared global
*
}
{
catch
{
r eval
{
a=10
}
0
}
e
catch
{
r eval
{
a=10
}
0
}
e
set e
set e
}
{
*ERR*assignment to undeclared*
}
}
{
*ERR*attempted to create global*
}
test
{
Globals protection bypassed using 'global' function
}
{
catch
{
r eval
{
global
(
"a"
);
a=10
;
return a
}
0
}
e
set e
}
{
10
}
test
{
Globals protection can be disabled
}
{
r config set lua-protect-globals no
catch
{
r eval
{
b=20
;
return b
}
0
}
e
set e
}
{
20
}
test
{
Globals protection can be re-enabled
}
{
r config set lua-protect-globals yes
catch
{
r eval
{
c=30
;
return c
}
0
}
e
set e
}
{
*ERR*assignment to undeclared*
}
test
{
Globals protection 'global' function works with mutliple args
}
{
catch
{
r eval
{
global
(
"var1"
,
"var2"
)
var1=10
var2=20
return
{
var1,var2
}
}
0
}
e
set e
}
{
10 20
}
}
}
start_server
{
tags
{
"scripting repl"
}}
{
start_server
{
tags
{
"scripting repl"
}}
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment