]> git.lizzy.rs Git - micro.git/commitdiff
Improve buffer test
authorZachary Yedidia <zyedidia@gmail.com>
Wed, 26 Feb 2020 04:21:50 +0000 (23:21 -0500)
committerZachary Yedidia <zyedidia@gmail.com>
Wed, 26 Feb 2020 04:21:50 +0000 (23:21 -0500)
internal/buffer/buffer_test.go

index e9e65fd524b61f30e91a87c4eec74729d8c87119..d5a027b410b033b58ee2be9bb44c79508191cff5 100644 (file)
@@ -85,7 +85,9 @@ func check(t *testing.T, before []string, operations []operation, after []string
 
        checkText(after)
 
-       for b.UndoStack.Peek() != nil {
+       // must have exactly two events per operation (delete and insert)
+       for range operations {
+               b.UndoOneEvent()
                b.UndoOneEvent()
        }
 
@@ -101,7 +103,8 @@ func check(t *testing.T, before []string, operations []operation, after []string
                }
        }
 
-       for b.RedoStack.Peek() != nil {
+       for range operations {
+               b.RedoOneEvent()
                b.RedoOneEvent()
        }