begin adding tests for 'diw' (delete-inside-word) motion
This commit is contained in:
@@ -4000,6 +4000,74 @@ struct
|
|||||||
end)
|
end)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
val diwDelete = describe "delete motion 'diw' (delete inside word)"
|
||||||
|
[test
|
||||||
|
"deletes middle word when middle word is \
|
||||||
|
\an alphanumeric word surrounded on both sides by spaces"
|
||||||
|
(fn _ =>
|
||||||
|
let
|
||||||
|
(* arrange *)
|
||||||
|
val originalString = "hello abc_123 world\n"
|
||||||
|
val app = TestUtils.init originalString
|
||||||
|
|
||||||
|
val app1 = AppWith.idx (app, 6)
|
||||||
|
val app2 = AppWith.idx (app, 7)
|
||||||
|
val app3 = AppWith.idx (app, 8)
|
||||||
|
val app4 = AppWith.idx (app, 9)
|
||||||
|
val app5 = AppWith.idx (app, 10)
|
||||||
|
val app6 = AppWith.idx (app, 11)
|
||||||
|
val app7 = AppWith.idx (app, 12)
|
||||||
|
|
||||||
|
(* act *)
|
||||||
|
val app1 = TestUtils.updateMany (app1, "diw")
|
||||||
|
val app2 = TestUtils.updateMany (app2, "diw")
|
||||||
|
val app3 = TestUtils.updateMany (app3, "diw")
|
||||||
|
val app4 = TestUtils.updateMany (app4, "diw")
|
||||||
|
val app5 = TestUtils.updateMany (app5, "diw")
|
||||||
|
val app6 = TestUtils.updateMany (app6, "diw")
|
||||||
|
val app7 = TestUtils.updateMany (app7, "diw")
|
||||||
|
|
||||||
|
(* assert *)
|
||||||
|
val expectedString = "hello world\n"
|
||||||
|
val expectedCursorIdx = 6
|
||||||
|
|
||||||
|
val actualString1 = LineGap.toString (#buffer app1)
|
||||||
|
val actualString2 = LineGap.toString (#buffer app2)
|
||||||
|
val actualString3 = LineGap.toString (#buffer app3)
|
||||||
|
val actualString4 = LineGap.toString (#buffer app4)
|
||||||
|
val actualString5 = LineGap.toString (#buffer app5)
|
||||||
|
val actualString6 = LineGap.toString (#buffer app6)
|
||||||
|
val actualString7 = LineGap.toString (#buffer app7)
|
||||||
|
|
||||||
|
val stringsAreExpected =
|
||||||
|
actualString1 = expectedString
|
||||||
|
andalso actualString2 = expectedString
|
||||||
|
andalso actualString3 = expectedString
|
||||||
|
andalso actualString4 = expectedString
|
||||||
|
andalso actualString5 = expectedString
|
||||||
|
andalso actualString6 = expectedString
|
||||||
|
andalso actualString7 = expectedString
|
||||||
|
|
||||||
|
val actualCursor1 = #cursorIdx app1
|
||||||
|
val actualCursor2 = #cursorIdx app2
|
||||||
|
val actualCursor3 = #cursorIdx app3
|
||||||
|
val actualCursor4 = #cursorIdx app4
|
||||||
|
val actualCursor5 = #cursorIdx app5
|
||||||
|
val actualCursor6 = #cursorIdx app6
|
||||||
|
val actualCursor7 = #cursorIdx app7
|
||||||
|
|
||||||
|
val cursorsAreExpected =
|
||||||
|
actualCursor1 = expectedCursorIdx
|
||||||
|
andalso actualCursor2 = expectedCursorIdx
|
||||||
|
andalso actualCursor3 = expectedCursorIdx
|
||||||
|
andalso actualCursor4 = expectedCursorIdx
|
||||||
|
andalso actualCursor5 = expectedCursorIdx
|
||||||
|
andalso actualCursor6 = expectedCursorIdx
|
||||||
|
andalso actualCursor7 = expectedCursorIdx
|
||||||
|
in
|
||||||
|
Expect.isTrue (stringsAreExpected andalso cursorsAreExpected)
|
||||||
|
end)]
|
||||||
|
|
||||||
val tests =
|
val tests =
|
||||||
[ dhDelete
|
[ dhDelete
|
||||||
, dlDelete
|
, dlDelete
|
||||||
@@ -4025,5 +4093,6 @@ struct
|
|||||||
, dtDelete
|
, dtDelete
|
||||||
, dFDelete
|
, dFDelete
|
||||||
, dTDelete
|
, dTDelete
|
||||||
|
, diwDelete
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user