Skip to content

Commit db28af9

Browse files
author
greg
committed
integration tests
1 parent bc8df20 commit db28af9

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

helix-term/tests/test/commands.rs

+50
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,53 @@ async fn test_selection_duplication() -> anyhow::Result<()> {
131131
.await?;
132132
Ok(())
133133
}
134+
135+
#[tokio::test]
136+
async fn increment_integer_test() -> anyhow::Result<()> {
137+
// correct selection placement with multiple -1 to zero
138+
// `-1-1-2-1-1` becomes `00-100`
139+
test((
140+
platform_line(indoc! {"\
141+
#[-|]#1#(-|)#1#(-|)#2#(-|)#1#(-|)#1
142+
"})
143+
.as_str(),
144+
"<C-a>",
145+
platform_line(indoc! {"\
146+
#[0|]##(0|)##(-|)#1#(0|)##(0|)#
147+
"})
148+
.as_str(),
149+
))
150+
.await?;
151+
152+
// correct selection placement with multiple -1 to zero, incremented twice
153+
// `-1-1-2-1-1` becomes `00-100` then `01-99`
154+
test((
155+
platform_line(indoc! {"\
156+
#[-|]#1#(-|)#1#(-|)#2#(-|)#1#(-|)#1
157+
"})
158+
.as_str(),
159+
"<C-a><C-a>",
160+
platform_line(indoc! {"\
161+
#[0|]#1#(-|)#99
162+
"})
163+
.as_str(),
164+
))
165+
.await?;
166+
167+
// correct selection placement with multiple 9 to 10
168+
// `9 9 9` becomes `10 10 10`
169+
test((
170+
platform_line(indoc! {"\
171+
#[9|]# #(9|)# #(9|)#
172+
"})
173+
.as_str(),
174+
"<C-a>",
175+
platform_line(indoc! {"\
176+
#[1|]#0 #(1|)#0 #(1|)#0
177+
"})
178+
.as_str(),
179+
))
180+
.await?;
181+
182+
Ok(())
183+
}

0 commit comments

Comments
 (0)