forked from onivim/oni2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
State: Initial buffer state (onivim#27)
* Add test case for buffer updates * Fix circular type dependency * Formatting * Hook up state buffer to view * Hook up Neovim's buffer updates to Oni's editor state
- Loading branch information
Showing
10 changed files
with
137 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* open Oni_Core; */ | ||
open TestFramework; | ||
|
||
open Helpers; | ||
|
||
open Oni_Core.Types; | ||
module Buffer = Oni_Core.Buffer; | ||
|
||
describe("update", ({test, _}) => { | ||
test("empty buffer w/ update", ({expect}) => { | ||
let buffer = Buffer.ofLines([||]); | ||
let update = BufferUpdate.create(~startLine=0, ~endLine=1, ~lines=["a"], ()); | ||
let updatedBuffer = Buffer.update(buffer, update); | ||
validateBuffer(expect, updatedBuffer, [|"a"|]); | ||
}); | ||
|
||
test("update single line", ({expect}) => { | ||
let buffer = Buffer.ofLines([|"a"|]); | ||
let update = BufferUpdate.create(~startLine=0, ~endLine=1, ~lines=["abc"], ()); | ||
let updatedBuffer = Buffer.update(buffer, update); | ||
validateBuffer(expect, updatedBuffer, [|"abc"|]); | ||
}); | ||
|
||
test("delete line", ({expect}) => { | ||
let buffer = Buffer.ofLines([|"a"|]); | ||
let update = BufferUpdate.create(~startLine=0, ~endLine=1, ~lines=[], ()); | ||
let updatedBuffer = Buffer.update(buffer, update); | ||
validateBuffer(expect, updatedBuffer, [||]); | ||
}); | ||
|
||
test("update single line", ({expect}) => { | ||
let buffer = Buffer.ofLines([|"a", "b", "c"|]); | ||
let update = BufferUpdate.create(~startLine=1, ~endLine=2, ~lines=["d", "e", "f"], ()); | ||
let updatedBuffer = Buffer.update(buffer, update); | ||
validateBuffer(expect, updatedBuffer, [|"a", "d", "e", "f", "c"|]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters