-
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.
- Loading branch information
1 parent
da282dd
commit 59349b5
Showing
12 changed files
with
70 additions
and
11 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,15 +1,27 @@ | ||
import { readFileSync } from "fs" | ||
import path from "path" | ||
import { compileToVts } from "../src/compile" | ||
import { compileVtsFile } from "../src/compile" | ||
|
||
test("I can compile a vts file and get a correctly formed vts_c file", async () => { | ||
const sourcePath = path.join(__dirname, "/resource/test.vts") | ||
const data = readFileSync(sourcePath).toString("utf-8") | ||
|
||
const actual = compileToVts(data).toString("utf-8") | ||
const actual = compileVtsFile(data).toString("utf-8") | ||
|
||
const expectedPath = path.join(__dirname, "/resource/test.vts_c") | ||
const expected = readFileSync(expectedPath).toString("utf-8") | ||
|
||
expect(actual).toBe(expected) | ||
}) | ||
|
||
test("I can compile a vts typescript file and get a correctly formed vts_c javascript file", async () => { | ||
const sourcePath = path.join(__dirname, "/resource/test_withTypes.vts") | ||
const data = readFileSync(sourcePath).toString("utf-8") | ||
|
||
const actual = compileVtsFile(data).toString("utf-8") | ||
|
||
const expectedPath = path.join(__dirname, "/resource/test_withTypes.vts_c") | ||
const expected = readFileSync(expectedPath).toString("utf-8") | ||
|
||
expect(actual).toBe(expected) | ||
}) |
Binary file not shown.
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,14 @@ | ||
import { Instance } from "cspointscript" | ||
|
||
type Player = { | ||
name: string | ||
score: number | ||
} | ||
|
||
const printPlayer = (player: Player) => { | ||
Instance.Msg(player.name + " has a score of " + player.score) | ||
} | ||
|
||
Instance.PublicMethod("PublicFunc", () => { | ||
printPlayer({ name: "Player1", score: 100 }) | ||
}) |
Binary file not shown.
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,8 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./dist", | ||
"noEmit": false | ||
}, | ||
"include": ["./src"] | ||
} |
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 |
---|---|---|
|
@@ -18,5 +18,5 @@ | |
"@/*": ["./*"] | ||
}, | ||
}, | ||
"include": ["./src"], | ||
"include": ["./src", "./tests"], | ||
} |