as-test 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/nodejs.yml +28 -0
- package/README.md +8 -8
- package/assembly/index.ts +1 -1
- package/assembly/src/expectation.ts +6 -6
- package/assembly/test.ts +0 -1
- package/package.json +6 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Node.js CI
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
steps:
|
|
11
|
+
- name: Checkout the repository
|
|
12
|
+
uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Install Wasmtime
|
|
15
|
+
uses: jcbhmr/setup-wasmtime@v2
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v2
|
|
19
|
+
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
if: steps.node-cache.outputs.cache-hit != 'true'
|
|
22
|
+
run: yarn
|
|
23
|
+
|
|
24
|
+
- name: Build tests
|
|
25
|
+
run: yarn run build:test
|
|
26
|
+
|
|
27
|
+
- name: Perform tests
|
|
28
|
+
run: yarn run test:wasmtime
|
package/README.md
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<h5 align="center">
|
|
2
|
-
<pre>
|
|
3
|
-
_____ _____ _____ _____ _____ _____
|
|
2
|
+
<pre> _____ _____ _____ _____ _____ _____
|
|
4
3
|
| _ || __| ___|_ _|| __|| __||_ _|
|
|
5
4
|
| ||__ ||___| | | | __||__ | | |
|
|
6
5
|
|__|__||_____| |_| |_____||_____| |_|
|
|
7
|
-
v0.0.
|
|
6
|
+
v0.0.5
|
|
8
7
|
</pre>
|
|
9
8
|
</h5>
|
|
10
9
|
|
|
@@ -66,9 +65,9 @@ describe("Math operations", () => {
|
|
|
66
65
|
});
|
|
67
66
|
});
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
let myArray;
|
|
68
|
+
let myArray: i32[] = [];
|
|
71
69
|
|
|
70
|
+
describe("Array manipulation", () => {
|
|
72
71
|
beforeAll(() => {
|
|
73
72
|
myArray = [1, 2, 3];
|
|
74
73
|
});
|
|
@@ -87,8 +86,8 @@ run({
|
|
|
87
86
|
});
|
|
88
87
|
```
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
_____ _____ _____ _____ _____ _____
|
|
89
|
+
<h6>
|
|
90
|
+
<pre> _____ _____ _____ _____ _____ _____
|
|
92
91
|
| _ || __| ___|_ _|| __|| __||_ _|
|
|
93
92
|
| ||__ ||___| | | | __||__ | | |
|
|
94
93
|
|__|__||_____| |_| |_____||_____| |_|
|
|
@@ -115,7 +114,8 @@ Test Suites: 0 failed, 2 total
|
|
|
115
114
|
Tests: 0 failed, 8 total
|
|
116
115
|
Snapshots: 0 total
|
|
117
116
|
Time: 101.812μs
|
|
118
|
-
|
|
117
|
+
</pre>
|
|
118
|
+
</h6>
|
|
119
119
|
|
|
120
120
|
If you use this project in your codebase, consider dropping a [⭐ HERE](https://github.com/JairusSW/as-test). I would really appreciate it!
|
|
121
121
|
|
package/assembly/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { rainbow } from "as-rainbow";
|
|
2
2
|
import { TestGroup } from "./src/group";
|
|
3
3
|
import { Expectation } from "./src/expectation";
|
|
4
|
-
import {
|
|
4
|
+
import { formatTime } from "./util";
|
|
5
5
|
import { stringify } from "as-console/assembly";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -5,9 +5,9 @@ import { Verdict } from "..";
|
|
|
5
5
|
|
|
6
6
|
export class Expectation<T> extends Node {
|
|
7
7
|
public verdict: Verdict = Verdict.Unreachable;
|
|
8
|
-
|
|
8
|
+
private left: T;
|
|
9
9
|
private _left: string | null = null;
|
|
10
|
-
|
|
10
|
+
private right: u64 = 0;
|
|
11
11
|
private _right: string | null = null;
|
|
12
12
|
private _not: boolean = false;
|
|
13
13
|
private op: string = "=";
|
|
@@ -44,7 +44,7 @@ export class Expectation<T> extends Node {
|
|
|
44
44
|
* @returns - void
|
|
45
45
|
*/
|
|
46
46
|
toBeGreaterThan(value: T): void {
|
|
47
|
-
if (!isInteger<T>() && !isFloat<T>())
|
|
47
|
+
if (!isInteger<T>() && !isFloat<T>()) ERROR("toBeGreaterThan() can only be used on number types!");
|
|
48
48
|
|
|
49
49
|
this.verdict = this.left > value ? Verdict.Ok : Verdict.Fail;
|
|
50
50
|
store<T>(changetype<usize>(this), value, offsetof<Expectation<T>>("right"));
|
|
@@ -63,7 +63,7 @@ export class Expectation<T> extends Node {
|
|
|
63
63
|
* @returns - void
|
|
64
64
|
*/
|
|
65
65
|
toBeGreaterOrEqualTo(value: T): void {
|
|
66
|
-
if (!isInteger<T>() && !isFloat<T>())
|
|
66
|
+
if (!isInteger<T>() && !isFloat<T>()) ERROR("toBeGreaterOrEqualTo() can only be used on number types!");
|
|
67
67
|
|
|
68
68
|
this.verdict = this.left >= value ? Verdict.Ok : Verdict.Fail;
|
|
69
69
|
store<T>(changetype<usize>(this), value, offsetof<Expectation<T>>("right"));
|
|
@@ -82,7 +82,7 @@ export class Expectation<T> extends Node {
|
|
|
82
82
|
* @returns - void
|
|
83
83
|
*/
|
|
84
84
|
toBeLessThan(value: T): void {
|
|
85
|
-
if (!isInteger<T>() && !isFloat<T>())
|
|
85
|
+
if (!isInteger<T>() && !isFloat<T>()) ERROR("toBeLessThan() can only be used on number types!");
|
|
86
86
|
|
|
87
87
|
this.verdict = this.left < value ? Verdict.Ok : Verdict.Fail;
|
|
88
88
|
store<T>(changetype<usize>(this), value, offsetof<Expectation<T>>("right"));
|
|
@@ -101,7 +101,7 @@ export class Expectation<T> extends Node {
|
|
|
101
101
|
* @returns - void
|
|
102
102
|
*/
|
|
103
103
|
toBeLessThanOrEqualTo(value: T): void {
|
|
104
|
-
if (!isInteger<T>() && !isFloat<T>())
|
|
104
|
+
if (!isInteger<T>() && !isFloat<T>()) ERROR("toBeLessThanOrEqualTo() can only be used on number types!");
|
|
105
105
|
|
|
106
106
|
this.verdict = this.left <= value ? Verdict.Ok : Verdict.Fail;
|
|
107
107
|
store<T>(changetype<usize>(this), value, offsetof<Expectation<T>>("right"));
|
package/assembly/test.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "as-test",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Testing framework for AssemblyScript. Compatible with WASI or Bindings ",
|
|
5
5
|
"types": "assembly/index.ts",
|
|
6
6
|
"author": "Jairus Tanaka",
|
|
@@ -31,7 +31,11 @@
|
|
|
31
31
|
"url": "git+https://github.com/JairusSW/as-test.git"
|
|
32
32
|
},
|
|
33
33
|
"keywords": [
|
|
34
|
-
"assemblyscript"
|
|
34
|
+
"assemblyscript",
|
|
35
|
+
"testing",
|
|
36
|
+
"test",
|
|
37
|
+
"as-pect",
|
|
38
|
+
"aspect"
|
|
35
39
|
],
|
|
36
40
|
"bugs": {
|
|
37
41
|
"url": "https://github.com/JairusSW/as-test/issues"
|