-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
35 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export type { TestDefinition } from "https://deno.land/x/[email protected]/tester.ts"; | ||
export { test } from "https://deno.land/x/[email protected]/tester.ts"; |
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 |
---|---|---|
@@ -1,16 +1,32 @@ | ||
import { fromFileUrl } from "./deps/std/path.ts"; | ||
import { autocmd, Denops } from "./deps.ts"; | ||
import * as DenopsTest from "./deps/denops_test.ts"; | ||
import * as path from "./deps/std/path.ts"; | ||
import { main } from "./main.ts"; | ||
import { currentContext } from "./store.ts"; | ||
|
||
export async function initDenops(denops: Denops): Promise<void> { | ||
const cfile = fromFileUrl(new URL(import.meta.url)); | ||
const path = cfile.slice(0, cfile.lastIndexOf("denops")); | ||
await denops.cmd(`set runtimepath^=${path.replaceAll("\\", "/")}`); | ||
await denops.cmd("source " + path + "plugin/skkeleton.vim"); | ||
await main(denops); | ||
await autocmd.emit(denops, "User", "DenopsSystemPluginPost:skkeleton", { | ||
nomodeline: true, | ||
const runtimepath = path.resolve( | ||
path.fromFileUrl(new URL("../..", import.meta.url)), | ||
); | ||
|
||
// It is inspired from https://github.com/lambdalisue/gin.vim/blob/e737a4b59a9d391c49aaa07f7c4d91e4a29ae09c/denops/gin/util/testutil.ts | ||
// Copyright 2021 Alisue <[email protected]> | ||
export function test(def: DenopsTest.TestDefinition): void { | ||
const fn = def.fn; | ||
DenopsTest.test({ | ||
...def, | ||
async fn(denops: Denops, t: Deno.TestContext) { | ||
await main(denops); | ||
await autocmd.emit(denops, "User", "DenopsSystemPluginPost:skkeleton", { | ||
nomodeline: true, | ||
}); | ||
currentContext.init().denops = denops; | ||
await fn(denops, t); | ||
}, | ||
pluginName: "skkeleton", | ||
prelude: [ | ||
`set runtimepath^=${runtimepath}`, | ||
"runtime! plugin/skkeleton.vim", | ||
...(def.prelude ?? []), | ||
], | ||
}); | ||
currentContext.init().denops = denops; | ||
} |