@as-pect/assembly 6.0.0 → 7.0.0
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/README.md +34 -34
- package/assembly/index.ts +24 -24
- package/assembly/internal/Actual.ts +20 -20
- package/assembly/internal/Expectation.ts +544 -481
- package/assembly/internal/Expected.ts +55 -55
- package/assembly/internal/Reflect.ts +698 -662
- package/assembly/internal/ReflectedValueType.ts +17 -17
- package/assembly/internal/Test.ts +81 -81
- package/assembly/internal/assert.ts +3 -3
- package/assembly/internal/call.ts +3 -3
- package/assembly/internal/comparison/toIncludeComparison.ts +67 -62
- package/assembly/internal/comparison/toIncludeEqualComparison.ts +91 -78
- package/assembly/internal/log.ts +19 -18
- package/assembly/internal/noOp.ts +3 -2
- package/package.json +17 -10
- package/types/as-pect.d.ts +733 -733
- package/types/as-pect.portable.d.ts +389 -389
- package/types/env.d.ts +1 -1
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
// @ts-ignore: Decorators *are* valid here!
|
|
2
|
-
@external("__aspect", "reportExpectedReflectedValue")
|
|
3
|
-
declare function reportExpectedReflectedValue(id: i32, negated: i32): void;
|
|
4
|
-
|
|
5
|
-
// @ts-ignore: Decorators *are* valid here!
|
|
6
|
-
@external("__aspect", "reportExpectedSnapshot")
|
|
7
|
-
declare function reportExpectedSnapshot(id: i32, name: string | null): void;
|
|
8
|
-
|
|
9
|
-
// @ts-ignore: Decorators *are* valid here!
|
|
10
|
-
@external("__aspect", "reportExpectedTruthy")
|
|
11
|
-
declare function reportExpectedTruthy(negated: i32): void;
|
|
12
|
-
|
|
13
|
-
// @ts-ignore: Decorators *are* valid here!
|
|
14
|
-
@external("__aspect", "reportExpectedFalsy")
|
|
15
|
-
declare function reportExpectedFalsy(negated: i32): void;
|
|
16
|
-
|
|
17
|
-
// @ts-ignore: Decorators *are* valid here!
|
|
18
|
-
@external("__aspect", "reportExpectedFinite")
|
|
19
|
-
declare function reportExpectedFinite(negated: i32): void;
|
|
20
|
-
|
|
21
|
-
// @ts-ignore: Decorators *are* valid here!
|
|
22
|
-
@external("__aspect", "clearExpected")
|
|
23
|
-
declare function clearExpected(): void;
|
|
24
|
-
|
|
25
|
-
@global
|
|
26
|
-
export class Expected {
|
|
27
|
-
static report<T>(expected: T, negated: i32 = 0): void {
|
|
28
|
-
let value = Reflect.toReflectedValue(expected);
|
|
29
|
-
Reflect.attachStackTrace(value);
|
|
30
|
-
reportExpectedReflectedValue(value, negated);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
static reportTruthy(negated: i32 = 0): void {
|
|
34
|
-
reportExpectedTruthy(negated);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static reportFalsy(negated: i32 = 0): void {
|
|
38
|
-
reportExpectedFalsy(negated);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
static reportFinite(negated: i32 = 0): void {
|
|
42
|
-
reportExpectedFinite(negated);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static reportSnapshot<T>(actual: T, name: string | null = null): void {
|
|
46
|
-
reportExpectedSnapshot(
|
|
47
|
-
Reflect.toReflectedValue(actual, new Map<usize, i32>()),
|
|
48
|
-
name,
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
static clear(): void {
|
|
53
|
-
clearExpected();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
// @ts-ignore: Decorators *are* valid here!
|
|
2
|
+
@external("__aspect", "reportExpectedReflectedValue")
|
|
3
|
+
declare function reportExpectedReflectedValue(id: i32, negated: i32): void;
|
|
4
|
+
|
|
5
|
+
// @ts-ignore: Decorators *are* valid here!
|
|
6
|
+
@external("__aspect", "reportExpectedSnapshot")
|
|
7
|
+
declare function reportExpectedSnapshot(id: i32, name: string | null): void;
|
|
8
|
+
|
|
9
|
+
// @ts-ignore: Decorators *are* valid here!
|
|
10
|
+
@external("__aspect", "reportExpectedTruthy")
|
|
11
|
+
declare function reportExpectedTruthy(negated: i32): void;
|
|
12
|
+
|
|
13
|
+
// @ts-ignore: Decorators *are* valid here!
|
|
14
|
+
@external("__aspect", "reportExpectedFalsy")
|
|
15
|
+
declare function reportExpectedFalsy(negated: i32): void;
|
|
16
|
+
|
|
17
|
+
// @ts-ignore: Decorators *are* valid here!
|
|
18
|
+
@external("__aspect", "reportExpectedFinite")
|
|
19
|
+
declare function reportExpectedFinite(negated: i32): void;
|
|
20
|
+
|
|
21
|
+
// @ts-ignore: Decorators *are* valid here!
|
|
22
|
+
@external("__aspect", "clearExpected")
|
|
23
|
+
declare function clearExpected(): void;
|
|
24
|
+
|
|
25
|
+
@global
|
|
26
|
+
export class Expected {
|
|
27
|
+
static report<T>(expected: T, negated: i32 = 0): void {
|
|
28
|
+
let value = Reflect.toReflectedValue(expected);
|
|
29
|
+
Reflect.attachStackTrace(value);
|
|
30
|
+
reportExpectedReflectedValue(value, negated);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static reportTruthy(negated: i32 = 0): void {
|
|
34
|
+
reportExpectedTruthy(negated);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static reportFalsy(negated: i32 = 0): void {
|
|
38
|
+
reportExpectedFalsy(negated);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static reportFinite(negated: i32 = 0): void {
|
|
42
|
+
reportExpectedFinite(negated);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static reportSnapshot<T>(actual: T, name: string | null = null): void {
|
|
46
|
+
reportExpectedSnapshot(
|
|
47
|
+
Reflect.toReflectedValue(actual, new Map<usize, i32>()),
|
|
48
|
+
name,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static clear(): void {
|
|
53
|
+
clearExpected();
|
|
54
|
+
}
|
|
55
|
+
}
|