Debian Codegraph @

tests/unittests/command_parse/test_script.py

raw
1 def test_eval(judge_command):
2 judge_command(
3 'eval "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}" 2 key1 key2 first second',
4 {
5 "command": "eval",
6 "double_lua": "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}",
7 "any": "2 key1 key2 first second",
8 },
9 )
10 judge_command(
11 "eval 'return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}' 2 key1 key2 first second",
12 {
13 "command": "eval",
14 "single_lua": "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}",
15 "any": "2 key1 key2 first second",
16 },
17 )
18
19
20 def test_scriptdebug(judge_command):
21 judge_command("SCRIPT DEBUG YES", {"command": "SCRIPT DEBUG", "scriptdebug": "YES"})
22 judge_command("SCRIPT DEBUG no", {"command": "SCRIPT DEBUG", "scriptdebug": "no"})
23
24
25 def test_script_flush(judge_command):
26 """SCRIPT FLUSH accepts optional ASYNC|SYNC (per commands.json since 6.2)."""
27 judge_command("SCRIPT FLUSH", {"command": "SCRIPT FLUSH"})
28 judge_command("SCRIPT FLUSH ASYNC", {"command": "SCRIPT FLUSH", "async": "ASYNC"})
29 judge_command("SCRIPT FLUSH SYNC", {"command": "SCRIPT FLUSH", "async": "SYNC"})