Skip to content

Commit 68250ef

Browse files
committed
Add more test cases for #223
Pull-request: #224 Signed-off-by: William Desportes <[email protected]>
1 parent e7a1f01 commit 68250ef

File tree

5 files changed

+284
-0
lines changed

5 files changed

+284
-0
lines changed

tests/Parser/CallStatementTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public function callProvider(): array
2525
['parser/parseCall'],
2626
['parser/parseCall2'],
2727
['parser/parseCall3'],
28+
['parser/parseCall4'],
29+
['parser/parseCall5'],
2830
];
2931
}
3032
}

tests/data/parser/parseCall4.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
call e();call f

tests/data/parser/parseCall4.out

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
{
2+
"query": "call e();call f",
3+
"lexer": {
4+
"@type": "PhpMyAdmin\\SqlParser\\Lexer",
5+
"str": "call e();call f",
6+
"len": 15,
7+
"last": 15,
8+
"list": {
9+
"@type": "PhpMyAdmin\\SqlParser\\TokensList",
10+
"tokens": [
11+
{
12+
"@type": "PhpMyAdmin\\SqlParser\\Token",
13+
"token": "call",
14+
"value": "CALL",
15+
"keyword": "CALL",
16+
"type": 1,
17+
"flags": 3,
18+
"position": 0
19+
},
20+
{
21+
"@type": "PhpMyAdmin\\SqlParser\\Token",
22+
"token": " ",
23+
"value": " ",
24+
"keyword": null,
25+
"type": 3,
26+
"flags": 0,
27+
"position": 4
28+
},
29+
{
30+
"@type": "PhpMyAdmin\\SqlParser\\Token",
31+
"token": "e",
32+
"value": "e",
33+
"keyword": null,
34+
"type": 0,
35+
"flags": 0,
36+
"position": 5
37+
},
38+
{
39+
"@type": "PhpMyAdmin\\SqlParser\\Token",
40+
"token": "(",
41+
"value": "(",
42+
"keyword": null,
43+
"type": 2,
44+
"flags": 16,
45+
"position": 6
46+
},
47+
{
48+
"@type": "PhpMyAdmin\\SqlParser\\Token",
49+
"token": ")",
50+
"value": ")",
51+
"keyword": null,
52+
"type": 2,
53+
"flags": 16,
54+
"position": 7
55+
},
56+
{
57+
"@type": "PhpMyAdmin\\SqlParser\\Token",
58+
"token": ";",
59+
"value": ";",
60+
"keyword": null,
61+
"type": 9,
62+
"flags": 0,
63+
"position": 8
64+
},
65+
{
66+
"@type": "PhpMyAdmin\\SqlParser\\Token",
67+
"token": "call",
68+
"value": "CALL",
69+
"keyword": "CALL",
70+
"type": 1,
71+
"flags": 3,
72+
"position": 9
73+
},
74+
{
75+
"@type": "PhpMyAdmin\\SqlParser\\Token",
76+
"token": " ",
77+
"value": " ",
78+
"keyword": null,
79+
"type": 3,
80+
"flags": 0,
81+
"position": 13
82+
},
83+
{
84+
"@type": "PhpMyAdmin\\SqlParser\\Token",
85+
"token": "f",
86+
"value": "f",
87+
"keyword": null,
88+
"type": 0,
89+
"flags": 0,
90+
"position": 14
91+
},
92+
{
93+
"@type": "PhpMyAdmin\\SqlParser\\Token",
94+
"token": null,
95+
"value": null,
96+
"keyword": null,
97+
"type": 9,
98+
"flags": 0,
99+
"position": null
100+
}
101+
],
102+
"count": 10,
103+
"idx": 10
104+
},
105+
"delimiter": ";",
106+
"delimiterLen": 1,
107+
"strict": false,
108+
"errors": []
109+
},
110+
"parser": {
111+
"@type": "PhpMyAdmin\\SqlParser\\Parser",
112+
"list": {
113+
"@type": "@1"
114+
},
115+
"statements": [
116+
{
117+
"@type": "PhpMyAdmin\\SqlParser\\Statements\\CallStatement",
118+
"call": {
119+
"@type": "PhpMyAdmin\\SqlParser\\Components\\FunctionCall",
120+
"name": "e",
121+
"parameters": {
122+
"@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj",
123+
"raw": [],
124+
"values": []
125+
}
126+
},
127+
"options": null,
128+
"first": 0,
129+
"last": 4
130+
},
131+
{
132+
"@type": "PhpMyAdmin\\SqlParser\\Statements\\CallStatement",
133+
"call": {
134+
"@type": "PhpMyAdmin\\SqlParser\\Components\\FunctionCall",
135+
"name": "f",
136+
"parameters": null
137+
},
138+
"options": null,
139+
"first": 5,
140+
"last": 8
141+
}
142+
],
143+
"brackets": 0,
144+
"strict": false,
145+
"errors": []
146+
},
147+
"errors": {
148+
"lexer": [],
149+
"parser": []
150+
}
151+
}

tests/data/parser/parseCall5.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
call e;call f

tests/data/parser/parseCall5.out

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
{
2+
"query": "call e;call f",
3+
"lexer": {
4+
"@type": "PhpMyAdmin\\SqlParser\\Lexer",
5+
"str": "call e;call f",
6+
"len": 13,
7+
"last": 13,
8+
"list": {
9+
"@type": "PhpMyAdmin\\SqlParser\\TokensList",
10+
"tokens": [
11+
{
12+
"@type": "PhpMyAdmin\\SqlParser\\Token",
13+
"token": "call",
14+
"value": "CALL",
15+
"keyword": "CALL",
16+
"type": 1,
17+
"flags": 3,
18+
"position": 0
19+
},
20+
{
21+
"@type": "PhpMyAdmin\\SqlParser\\Token",
22+
"token": " ",
23+
"value": " ",
24+
"keyword": null,
25+
"type": 3,
26+
"flags": 0,
27+
"position": 4
28+
},
29+
{
30+
"@type": "PhpMyAdmin\\SqlParser\\Token",
31+
"token": "e",
32+
"value": "e",
33+
"keyword": null,
34+
"type": 0,
35+
"flags": 0,
36+
"position": 5
37+
},
38+
{
39+
"@type": "PhpMyAdmin\\SqlParser\\Token",
40+
"token": ";",
41+
"value": ";",
42+
"keyword": null,
43+
"type": 9,
44+
"flags": 0,
45+
"position": 6
46+
},
47+
{
48+
"@type": "PhpMyAdmin\\SqlParser\\Token",
49+
"token": "call",
50+
"value": "CALL",
51+
"keyword": "CALL",
52+
"type": 1,
53+
"flags": 3,
54+
"position": 7
55+
},
56+
{
57+
"@type": "PhpMyAdmin\\SqlParser\\Token",
58+
"token": " ",
59+
"value": " ",
60+
"keyword": null,
61+
"type": 3,
62+
"flags": 0,
63+
"position": 11
64+
},
65+
{
66+
"@type": "PhpMyAdmin\\SqlParser\\Token",
67+
"token": "f",
68+
"value": "f",
69+
"keyword": null,
70+
"type": 0,
71+
"flags": 0,
72+
"position": 12
73+
},
74+
{
75+
"@type": "PhpMyAdmin\\SqlParser\\Token",
76+
"token": null,
77+
"value": null,
78+
"keyword": null,
79+
"type": 9,
80+
"flags": 0,
81+
"position": null
82+
}
83+
],
84+
"count": 8,
85+
"idx": 8
86+
},
87+
"delimiter": ";",
88+
"delimiterLen": 1,
89+
"strict": false,
90+
"errors": []
91+
},
92+
"parser": {
93+
"@type": "PhpMyAdmin\\SqlParser\\Parser",
94+
"list": {
95+
"@type": "@1"
96+
},
97+
"statements": [
98+
{
99+
"@type": "PhpMyAdmin\\SqlParser\\Statements\\CallStatement",
100+
"call": {
101+
"@type": "PhpMyAdmin\\SqlParser\\Components\\FunctionCall",
102+
"name": "e",
103+
"parameters": null
104+
},
105+
"options": null,
106+
"first": 0,
107+
"last": 2
108+
},
109+
{
110+
"@type": "PhpMyAdmin\\SqlParser\\Statements\\CallStatement",
111+
"call": {
112+
"@type": "PhpMyAdmin\\SqlParser\\Components\\FunctionCall",
113+
"name": "f",
114+
"parameters": null
115+
},
116+
"options": null,
117+
"first": 3,
118+
"last": 6
119+
}
120+
],
121+
"brackets": 0,
122+
"strict": false,
123+
"errors": []
124+
},
125+
"errors": {
126+
"lexer": [],
127+
"parser": []
128+
}
129+
}

0 commit comments

Comments
 (0)