Skip to content

Commit 0cd2a63

Browse files
authored
Add tests (#21)
* Added tests for table (failing) * Added test step to CI * Add jest dependency * Moved test to its own CI job separate from lint * Added a whole bunch of tests * Prettier format * Removed not needed records
1 parent 651ab44 commit 0cd2a63

34 files changed

+14860
-2364
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: 2
22
updates:
3-
- package-ecosystem: 'npm'
4-
directory: '/'
5-
schedule:
6-
interval: 'daily'
7-
allow:
8-
- dependency-name: 'typescript-to-lua'
3+
- package-ecosystem: 'npm'
4+
directory: '/'
5+
schedule:
6+
interval: 'daily'
7+
allow:
8+
- dependency-name: 'typescript-to-lua'

.github/workflows/ci.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,28 @@ name: CI
33
on: [push, pull_request]
44

55
jobs:
6-
lint:
7-
name: Lint
8-
runs-on: ubuntu-latest
6+
lint:
7+
name: Lint
8+
runs-on: ubuntu-latest
99

10-
steps:
11-
- uses: actions/checkout@v2
12-
- name: Use Node.js 12
13-
uses: actions/setup-node@v1
14-
with:
15-
node-version: 12
16-
- run: npm ci
17-
- run: npm run lint
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Use Node.js 12
13+
uses: actions/setup-node@v1
14+
with:
15+
node-version: 12
16+
- run: npm ci
17+
- run: npm run lint
18+
19+
test:
20+
name: Test
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Use Node.js 12
26+
uses: actions/setup-node@v1
27+
with:
28+
node-version: 12
29+
- run: npm ci
30+
- run: npm test

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ npm install -D lua-types
2828

2929
Where `<version>` is one of:
3030

31-
- `5.1`
32-
- `5.2`
33-
- `5.3`
34-
- `5.4`
35-
- `jit`
31+
- `5.1`
32+
- `5.2`
33+
- `5.3`
34+
- `5.4`
35+
- `jit`
3636

3737
> NOTE: All other files in this module shouldn't be considered public. Do not import them manually, as they may change in non-major updates. If your environment doesn't provide all of standard Lua features, consider banning them with a [no-restricted-globals](https://eslint.org/docs/rules/no-restricted-globals) eslint rule.

core/coroutine.d.ts

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,50 @@
77
* inside the table coroutine.
88
*/
99
declare namespace coroutine {
10-
/**
11-
* Creates a new coroutine, with body f. f must be a function. Returns this
12-
* new coroutine, an object with type "thread".
13-
*/
14-
function create(f: (...args: any[]) => any): LuaThread;
10+
/**
11+
* Creates a new coroutine, with body f. f must be a function. Returns this
12+
* new coroutine, an object with type "thread".
13+
*/
14+
function create(f: (...args: any[]) => any): LuaThread;
1515

16-
/**
17-
* Starts or continues the execution of coroutine co. The first time you
18-
* resume a coroutine, it starts running its body. The values val1, ... are
19-
* passed as the arguments to the body function. If the coroutine has yielded,
20-
* resume restarts it; the values val1, ... are passed as the results from the
21-
* yield.
22-
*
23-
* If the coroutine runs without any errors, resume returns true plus any
24-
* values passed to yield (when the coroutine yields) or any values returned
25-
* by the body function (when the coroutine terminates). If there is any
26-
* error, resume returns false plus the error message.
27-
* @tupleReturn
28-
*/
29-
function resume(co: LuaThread, ...val: any[]): [true, ...any[]] | [false, string];
16+
/**
17+
* Starts or continues the execution of coroutine co. The first time you
18+
* resume a coroutine, it starts running its body. The values val1, ... are
19+
* passed as the arguments to the body function. If the coroutine has yielded,
20+
* resume restarts it; the values val1, ... are passed as the results from the
21+
* yield.
22+
*
23+
* If the coroutine runs without any errors, resume returns true plus any
24+
* values passed to yield (when the coroutine yields) or any values returned
25+
* by the body function (when the coroutine terminates). If there is any
26+
* error, resume returns false plus the error message.
27+
* @tupleReturn
28+
*/
29+
function resume(co: LuaThread, ...val: any[]): [true, ...any[]] | [false, string];
3030

31-
/**
32-
* Returns the status of coroutine co, as a string: "running", if the
33-
* coroutine is running (that is, it called status); "suspended", if the
34-
* coroutine is suspended in a call to yield, or if it has not started running
35-
* yet; "normal" if the coroutine is active but not running (that is, it has
36-
* resumed another coroutine); and "dead" if the coroutine has finished its
37-
* body function, or if it has stopped with an error.
38-
*/
39-
function status(co: LuaThread): 'running' | 'suspended' | 'normal' | 'dead';
31+
/**
32+
* Returns the status of coroutine co, as a string: "running", if the
33+
* coroutine is running (that is, it called status); "suspended", if the
34+
* coroutine is suspended in a call to yield, or if it has not started running
35+
* yet; "normal" if the coroutine is active but not running (that is, it has
36+
* resumed another coroutine); and "dead" if the coroutine has finished its
37+
* body function, or if it has stopped with an error.
38+
*/
39+
function status(co: LuaThread): 'running' | 'suspended' | 'normal' | 'dead';
4040

41-
/**
42-
* Creates a new coroutine, with body f. f must be a function. Returns a
43-
* function that resumes the coroutine each time it is called. Any arguments
44-
* passed to the function behave as the extra arguments to resume. Returns the
45-
* same values returned by resume, except the first boolean. In case of error,
46-
* propagates the error.
47-
*/
48-
function wrap(f: (...args: any[]) => any): /** @tupleReturn */ (...args: any[]) => any[];
41+
/**
42+
* Creates a new coroutine, with body f. f must be a function. Returns a
43+
* function that resumes the coroutine each time it is called. Any arguments
44+
* passed to the function behave as the extra arguments to resume. Returns the
45+
* same values returned by resume, except the first boolean. In case of error,
46+
* propagates the error.
47+
*/
48+
function wrap(f: (...args: any[]) => any): /** @tupleReturn */ (...args: any[]) => any[];
4949

50-
/**
51-
* Suspends the execution of the calling coroutine. Any arguments to yield are
52-
* passed as extra results to resume.
53-
* @tupleReturn
54-
*/
55-
function yield(...args: any[]): any[];
50+
/**
51+
* Suspends the execution of the calling coroutine. Any arguments to yield are
52+
* passed as extra results to resume.
53+
* @tupleReturn
54+
*/
55+
function yield(...args: any[]): any[];
5656
}

0 commit comments

Comments
 (0)