This repository was archived by the owner on Jul 6, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
integration-test/java/org/neo4j/shell/commands
main/java/org/neo4j/shell/commands
test/java/org/neo4j/shell/commands Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ public void commitScenario() throws CommandException {
162162 }
163163
164164 @ Test
165- public void setAndListVariables () throws CommandException {
165+ public void paramsAndListVariables () throws CommandException {
166166 assertTrue (shell .getAll ().isEmpty ());
167167
168168 long randomLong = System .currentTimeMillis ();
Original file line number Diff line number Diff line change 1616 */
1717public class Param implements Command {
1818 // Match arguments such as "(key) (value with possible spaces)" where key and value are any strings
19- private static final Pattern argPattern = Pattern .compile ("^\\ s*(?<key>[^ \\ s]+) \\ s+(?<value>.+)$" );
19+ private static final Pattern argPattern = Pattern .compile ("^\\ s*(?<key>.+?):? \\ s+(?<value>.+)$" );
2020 public static final String COMMAND_NAME = ":param" ;
2121 private final VariableHolder variableHolder ;
2222
Original file line number Diff line number Diff line change @@ -50,12 +50,34 @@ public void setValue() throws CommandException {
5050 verify (mockShell ).set ("bob" , "9" );
5151 }
5252
53+ @ Test
54+ public void setValueWithSpecialCharacters () throws CommandException {
55+ cmd .execute ("bob# 9" );
56+
57+ verify (mockShell ).set ("bob#" , "9" );
58+ }
59+
5360 @ Test
5461 public void shouldNotSplitOnSpace () throws CommandException {
5562 cmd .execute ("bob 'one two'" );
5663 verify (mockShell ).set ("bob" , "'one two'" );
5764 }
5865
66+ @ Test
67+ public void shouldAcceptColonFormOfParams () throws CommandException {
68+ cmd .execute ("bob: one" );
69+ verify (mockShell ).set ("bob" , "one" );
70+ }
71+
72+ @ Test
73+ public void shouldAcceptForTwoColonsFormOfParams () throws CommandException {
74+ cmd .execute ("bob:: one" );
75+ verify (mockShell ).set ("bob:" , "one" );
76+
77+ cmd .execute ("t:om two" );
78+ verify (mockShell ).set ("t:om" , "two" );
79+ }
80+
5981 @ Test
6082 public void shouldNotExecuteEscapedCypher () throws CommandException {
6183 cmd .execute ("bob \" RETURN 5 as bob\" " );
You can’t perform that action at this time.
0 commit comments