Skip to content

Commit db96d60

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

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

helix-term/tests/test/commands.rs

+31
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,34 @@ 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! {"#[-|]#1#(-|)#1#(-|)#2#(-|)#1#(-|)#1"}).as_str(),
141+
"<C-a>",
142+
platform_line(indoc! {"#[0|]##(0|)##(-|)#1#(0|)##(0|)#"}).as_str(),
143+
))
144+
.await?;
145+
146+
// correct selection placement with multiple -1 to zero, incremented twice
147+
// `-1-1-2-1-1` becomes `00-100` then `01-99`
148+
test((
149+
platform_line(indoc! {"#[-|]#1#(-|)#1#(-|)#2#(-|)#1#(-|)#1"}).as_str(),
150+
"<C-a><C-a>",
151+
platform_line(indoc! {"#[0|]#1#(-|)#99"}).as_str(),
152+
))
153+
.await?;
154+
155+
// correct selection placement with multiple 9 to 10
156+
// `9 9 9` becomes `10 10 10`
157+
test((
158+
platform_line(indoc! {"#[9|]# #(9|)# #(9|)#"}).as_str(),
159+
"<C-a>",
160+
platform_line(indoc! {"#[1|]#0 #(1|)#0 #(1|)#0"}).as_str(),
161+
))
162+
.await?;
163+
Ok(())
164+
}

0 commit comments

Comments
 (0)