@uistate/renderer 1.0.0 → 1.0.1
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/package.json +1 -1
- package/self-test.js +4 -6
package/package.json
CHANGED
package/self-test.js
CHANGED
|
@@ -17,14 +17,14 @@ let failed = 0;
|
|
|
17
17
|
function assert(name, condition) {
|
|
18
18
|
if (condition) {
|
|
19
19
|
passed++;
|
|
20
|
+
console.log(` ✓ ${name}`);
|
|
20
21
|
} else {
|
|
21
22
|
failed++;
|
|
22
23
|
console.error(` ✗ ${name}`);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
console.log('\n1. parseSetExpr');
|
|
28
28
|
const p1 = parseSetExpr('count:increment');
|
|
29
29
|
assert('parseSetExpr: path', p1.path === 'count');
|
|
30
30
|
assert('parseSetExpr: expr', p1.expr === 'increment');
|
|
@@ -60,8 +60,7 @@ const p9 = parseSetExpr(' count : increment ');
|
|
|
60
60
|
assert('parseSetExpr: trims whitespace path', p9.path === 'count');
|
|
61
61
|
assert('parseSetExpr: trims whitespace expr', p9.expr === 'increment');
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
console.log('\n2. evalExpr');
|
|
65
64
|
assert('evalExpr: increment', evalExpr('increment', 5) === 6);
|
|
66
65
|
assert('evalExpr: increment from 0', evalExpr('increment', 0) === 1);
|
|
67
66
|
assert('evalExpr: increment from null', evalExpr('increment', null) === 1);
|
|
@@ -79,8 +78,7 @@ assert('evalExpr: plain string', evalExpr('hello', '') === 'hello');
|
|
|
79
78
|
assert('evalExpr: null expr → returns current', evalExpr(null, 7) === 7);
|
|
80
79
|
assert('evalExpr: undefined expr → returns current', evalExpr(undefined, 7) === 7);
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
console.log('\n3. parsePush');
|
|
84
82
|
const pp1 = parsePush('push');
|
|
85
83
|
assert('parsePush: bare push → source null', pp1 !== null && pp1.source === null);
|
|
86
84
|
|