Skip to content

Commit 1ea97d3

Browse files
test: add ExpectedWhitespace aac test, #6627
1 parent 83f08ad commit 1ea97d3

File tree

2 files changed

+228
-0
lines changed

2 files changed

+228
-0
lines changed

stackslib/src/chainstate/tests/parse_tests.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,15 @@ fn test_note_to_match_this() {
246246
contract_code: "())",
247247
);
248248
}
249+
250+
/// ParserError: [`ParseErrors::ExpectedWhitespace`]
251+
/// Caused by: missing space before expression
252+
/// Outcome: block accepted
253+
#[test]
254+
fn test_expected_white_space() {
255+
contract_deploy_consensus_test!(
256+
contract_name: "my-contract",
257+
//miss space between (get-one) and (ok u1)
258+
contract_code: "(define-public (get-one)(ok u1))",
259+
);
260+
}
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
---
2+
source: stackslib/src/chainstate/tests/parse_tests.rs
3+
expression: result
4+
---
5+
[
6+
Success(ExpectedBlockOutput(
7+
marf_hash: "d5b59f773e6001ae66d3f157abc1a9dc17dbd4c8648c1aa4eb83fb8840104c7c",
8+
evaluated_epoch: Epoch32,
9+
transactions: [
10+
ExpectedTransactionOutput(
11+
tx: "SmartContract(name: my-contract-Epoch3_2-Clarity1, code_body: [..], clarity_version: Some(Clarity1))",
12+
vm_error: "Some(expected whitespace before expression) [NON-CONSENSUS BREAKING]",
13+
return_type: Response(ResponseData(
14+
committed: false,
15+
data: Optional(OptionalData(
16+
data: None,
17+
)),
18+
)),
19+
cost: ExecutionCost(
20+
write_length: 0,
21+
write_count: 0,
22+
read_length: 0,
23+
read_count: 0,
24+
runtime: 945,
25+
),
26+
),
27+
],
28+
total_block_cost: ExecutionCost(
29+
write_length: 0,
30+
write_count: 0,
31+
read_length: 0,
32+
read_count: 0,
33+
runtime: 945,
34+
),
35+
)),
36+
Success(ExpectedBlockOutput(
37+
marf_hash: "e7806daa79ed9b134f038aca00f26798ec949122c5b83fcc9a78173d88df4f0e",
38+
evaluated_epoch: Epoch32,
39+
transactions: [
40+
ExpectedTransactionOutput(
41+
tx: "SmartContract(name: my-contract-Epoch3_2-Clarity2, code_body: [..], clarity_version: Some(Clarity2))",
42+
vm_error: "Some(expected whitespace before expression) [NON-CONSENSUS BREAKING]",
43+
return_type: Response(ResponseData(
44+
committed: false,
45+
data: Optional(OptionalData(
46+
data: None,
47+
)),
48+
)),
49+
cost: ExecutionCost(
50+
write_length: 0,
51+
write_count: 0,
52+
read_length: 0,
53+
read_count: 0,
54+
runtime: 945,
55+
),
56+
),
57+
],
58+
total_block_cost: ExecutionCost(
59+
write_length: 0,
60+
write_count: 0,
61+
read_length: 0,
62+
read_count: 0,
63+
runtime: 945,
64+
),
65+
)),
66+
Success(ExpectedBlockOutput(
67+
marf_hash: "b46ed328ae04ddcbedd56b788d1e1445310adbd2e35c554fb08c1b905caf521c",
68+
evaluated_epoch: Epoch32,
69+
transactions: [
70+
ExpectedTransactionOutput(
71+
tx: "SmartContract(name: my-contract-Epoch3_2-Clarity3, code_body: [..], clarity_version: Some(Clarity3))",
72+
vm_error: "Some(expected whitespace before expression) [NON-CONSENSUS BREAKING]",
73+
return_type: Response(ResponseData(
74+
committed: false,
75+
data: Optional(OptionalData(
76+
data: None,
77+
)),
78+
)),
79+
cost: ExecutionCost(
80+
write_length: 0,
81+
write_count: 0,
82+
read_length: 0,
83+
read_count: 0,
84+
runtime: 945,
85+
),
86+
),
87+
],
88+
total_block_cost: ExecutionCost(
89+
write_length: 0,
90+
write_count: 0,
91+
read_length: 0,
92+
read_count: 0,
93+
runtime: 945,
94+
),
95+
)),
96+
Success(ExpectedBlockOutput(
97+
marf_hash: "a08150342b5733b46708e548bed0fecfc64da84b47959903ba573839071eef44",
98+
evaluated_epoch: Epoch33,
99+
transactions: [
100+
ExpectedTransactionOutput(
101+
tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))",
102+
vm_error: "Some(expected whitespace before expression) [NON-CONSENSUS BREAKING]",
103+
return_type: Response(ResponseData(
104+
committed: false,
105+
data: Optional(OptionalData(
106+
data: None,
107+
)),
108+
)),
109+
cost: ExecutionCost(
110+
write_length: 0,
111+
write_count: 0,
112+
read_length: 0,
113+
read_count: 0,
114+
runtime: 945,
115+
),
116+
),
117+
],
118+
total_block_cost: ExecutionCost(
119+
write_length: 0,
120+
write_count: 0,
121+
read_length: 0,
122+
read_count: 0,
123+
runtime: 945,
124+
),
125+
)),
126+
Success(ExpectedBlockOutput(
127+
marf_hash: "8315a49e5ec79593cae3e58e97f91e62aac0c40e558adadc729ce69c2a67e8e1",
128+
evaluated_epoch: Epoch33,
129+
transactions: [
130+
ExpectedTransactionOutput(
131+
tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))",
132+
vm_error: "Some(expected whitespace before expression) [NON-CONSENSUS BREAKING]",
133+
return_type: Response(ResponseData(
134+
committed: false,
135+
data: Optional(OptionalData(
136+
data: None,
137+
)),
138+
)),
139+
cost: ExecutionCost(
140+
write_length: 0,
141+
write_count: 0,
142+
read_length: 0,
143+
read_count: 0,
144+
runtime: 945,
145+
),
146+
),
147+
],
148+
total_block_cost: ExecutionCost(
149+
write_length: 0,
150+
write_count: 0,
151+
read_length: 0,
152+
read_count: 0,
153+
runtime: 945,
154+
),
155+
)),
156+
Success(ExpectedBlockOutput(
157+
marf_hash: "9e6357f91a80a21285d8f7e68fecfa32dcf7b6088002b05028dcb80f55ae889f",
158+
evaluated_epoch: Epoch33,
159+
transactions: [
160+
ExpectedTransactionOutput(
161+
tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))",
162+
vm_error: "Some(expected whitespace before expression) [NON-CONSENSUS BREAKING]",
163+
return_type: Response(ResponseData(
164+
committed: false,
165+
data: Optional(OptionalData(
166+
data: None,
167+
)),
168+
)),
169+
cost: ExecutionCost(
170+
write_length: 0,
171+
write_count: 0,
172+
read_length: 0,
173+
read_count: 0,
174+
runtime: 945,
175+
),
176+
),
177+
],
178+
total_block_cost: ExecutionCost(
179+
write_length: 0,
180+
write_count: 0,
181+
read_length: 0,
182+
read_count: 0,
183+
runtime: 945,
184+
),
185+
)),
186+
Success(ExpectedBlockOutput(
187+
marf_hash: "3c2cd34922d7dbe15950c4ded5500794faa681bc8499a961a71083ccf8c57282",
188+
evaluated_epoch: Epoch33,
189+
transactions: [
190+
ExpectedTransactionOutput(
191+
tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))",
192+
vm_error: "Some(expected whitespace before expression) [NON-CONSENSUS BREAKING]",
193+
return_type: Response(ResponseData(
194+
committed: false,
195+
data: Optional(OptionalData(
196+
data: None,
197+
)),
198+
)),
199+
cost: ExecutionCost(
200+
write_length: 0,
201+
write_count: 0,
202+
read_length: 0,
203+
read_count: 0,
204+
runtime: 945,
205+
),
206+
),
207+
],
208+
total_block_cost: ExecutionCost(
209+
write_length: 0,
210+
write_count: 0,
211+
read_length: 0,
212+
read_count: 0,
213+
runtime: 945,
214+
),
215+
)),
216+
]

0 commit comments

Comments
 (0)