mol_dump_lib 0.0.917 → 0.0.919
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/node.deps.json +1 -1
- package/node.js +6 -7
- package/node.js.map +1 -1
- package/node.mjs +6 -7
- package/node.test.js +1278 -1279
- package/node.test.js.map +1 -1
- package/package.json +1 -1
package/node.test.js
CHANGED
|
@@ -140,13 +140,7 @@ var $node = new Proxy({ require }, {
|
|
|
140
140
|
target.require.resolve(name);
|
|
141
141
|
}
|
|
142
142
|
catch {
|
|
143
|
-
|
|
144
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
145
|
-
}
|
|
146
|
-
catch (e) {
|
|
147
|
-
if ($$.$mol_promise_like(e))
|
|
148
|
-
$$.$mol_fail_hidden(e);
|
|
149
|
-
}
|
|
143
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
150
144
|
try {
|
|
151
145
|
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
152
146
|
}
|
|
@@ -155,6 +149,11 @@ var $node = new Proxy({ require }, {
|
|
|
155
149
|
$$.$mol_fail_hidden(e);
|
|
156
150
|
$$.$mol_fail_log(e);
|
|
157
151
|
}
|
|
152
|
+
const mam_node_modules = target.require('node:path').join(process.cwd(), 'node_modules');
|
|
153
|
+
if (!process.env.NODE_PATH?.includes(mam_node_modules)) {
|
|
154
|
+
process.env.NODE_PATH = `${mam_node_modules}${process.env.NODE_PATH ? `:${process.env.NODE_PATH}` : ''}`;
|
|
155
|
+
target.require('node:module').Module._initPaths();
|
|
156
|
+
}
|
|
158
157
|
}
|
|
159
158
|
return target.require(name);
|
|
160
159
|
},
|
|
@@ -7719,24 +7718,68 @@ var $;
|
|
|
7719
7718
|
$.$mol_test_complete = $mol_test_complete;
|
|
7720
7719
|
})($ || ($ = {}));
|
|
7721
7720
|
|
|
7722
|
-
;
|
|
7723
|
-
"use strict";
|
|
7724
|
-
|
|
7725
|
-
;
|
|
7726
|
-
"use strict";
|
|
7727
|
-
|
|
7728
|
-
;
|
|
7729
|
-
"use strict";
|
|
7730
|
-
|
|
7731
7721
|
;
|
|
7732
7722
|
"use strict";
|
|
7733
7723
|
var $;
|
|
7734
7724
|
(function ($) {
|
|
7735
|
-
function $
|
|
7736
|
-
|
|
7737
|
-
|
|
7725
|
+
function $mol_assert_ok(value) {
|
|
7726
|
+
if (value)
|
|
7727
|
+
return;
|
|
7728
|
+
$mol_fail(new Error(`${value} ≠ true`));
|
|
7738
7729
|
}
|
|
7739
|
-
$.$
|
|
7730
|
+
$.$mol_assert_ok = $mol_assert_ok;
|
|
7731
|
+
function $mol_assert_not(value) {
|
|
7732
|
+
if (!value)
|
|
7733
|
+
return;
|
|
7734
|
+
$mol_fail(new Error(`${value} ≠ false`));
|
|
7735
|
+
}
|
|
7736
|
+
$.$mol_assert_not = $mol_assert_not;
|
|
7737
|
+
function $mol_assert_fail(handler, ErrorRight) {
|
|
7738
|
+
const fail = $.$mol_fail;
|
|
7739
|
+
try {
|
|
7740
|
+
$.$mol_fail = $.$mol_fail_hidden;
|
|
7741
|
+
handler();
|
|
7742
|
+
}
|
|
7743
|
+
catch (error) {
|
|
7744
|
+
$.$mol_fail = fail;
|
|
7745
|
+
if (typeof ErrorRight === 'string') {
|
|
7746
|
+
$mol_assert_equal(error.message ?? error, ErrorRight);
|
|
7747
|
+
}
|
|
7748
|
+
else {
|
|
7749
|
+
$mol_assert_equal(error instanceof ErrorRight, true);
|
|
7750
|
+
}
|
|
7751
|
+
return error;
|
|
7752
|
+
}
|
|
7753
|
+
finally {
|
|
7754
|
+
$.$mol_fail = fail;
|
|
7755
|
+
}
|
|
7756
|
+
$mol_fail(new Error('Not failed'));
|
|
7757
|
+
}
|
|
7758
|
+
$.$mol_assert_fail = $mol_assert_fail;
|
|
7759
|
+
function $mol_assert_like(...args) {
|
|
7760
|
+
$mol_assert_equal(...args);
|
|
7761
|
+
}
|
|
7762
|
+
$.$mol_assert_like = $mol_assert_like;
|
|
7763
|
+
function $mol_assert_unique(...args) {
|
|
7764
|
+
for (let i = 0; i < args.length; ++i) {
|
|
7765
|
+
for (let j = 0; j < args.length; ++j) {
|
|
7766
|
+
if (i === j)
|
|
7767
|
+
continue;
|
|
7768
|
+
if (!$mol_compare_deep(args[i], args[j]))
|
|
7769
|
+
continue;
|
|
7770
|
+
return $mol_fail(new Error(`Uniquesess assertion failure`, { cause: { [i]: args[i], [i]: args[i] } }));
|
|
7771
|
+
}
|
|
7772
|
+
}
|
|
7773
|
+
}
|
|
7774
|
+
$.$mol_assert_unique = $mol_assert_unique;
|
|
7775
|
+
function $mol_assert_equal(...args) {
|
|
7776
|
+
for (let i = 1; i < args.length; ++i) {
|
|
7777
|
+
if ($mol_compare_deep(args[0], args[i]))
|
|
7778
|
+
continue;
|
|
7779
|
+
return $mol_fail(new Error(`Equality assertion failure`, { cause: { 0: args[0], [i]: args[i] } }));
|
|
7780
|
+
}
|
|
7781
|
+
}
|
|
7782
|
+
$.$mol_assert_equal = $mol_assert_equal;
|
|
7740
7783
|
})($ || ($ = {}));
|
|
7741
7784
|
|
|
7742
7785
|
;
|
|
@@ -7744,516 +7787,371 @@ var $;
|
|
|
7744
7787
|
var $;
|
|
7745
7788
|
(function ($) {
|
|
7746
7789
|
$mol_test({
|
|
7747
|
-
'
|
|
7748
|
-
$
|
|
7749
|
-
},
|
|
7750
|
-
'Define native field'() {
|
|
7751
|
-
const dom = $mol_jsx("input", { value: '123' });
|
|
7752
|
-
$mol_assert_equal(dom.outerHTML, '<input value="123">');
|
|
7753
|
-
$mol_assert_equal(dom.value, '123');
|
|
7754
|
-
},
|
|
7755
|
-
'Define classes'() {
|
|
7756
|
-
const dom = $mol_jsx("div", { class: 'foo bar' });
|
|
7757
|
-
$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
7758
|
-
},
|
|
7759
|
-
'Define styles'() {
|
|
7760
|
-
const dom = $mol_jsx("div", { style: { color: 'red' } });
|
|
7761
|
-
$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
7790
|
+
'must be false'() {
|
|
7791
|
+
$mol_assert_not(0);
|
|
7762
7792
|
},
|
|
7763
|
-
'
|
|
7764
|
-
|
|
7765
|
-
$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
7793
|
+
'must be true'() {
|
|
7794
|
+
$mol_assert_ok(1);
|
|
7766
7795
|
},
|
|
7767
|
-
'
|
|
7768
|
-
|
|
7769
|
-
$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
7796
|
+
'two must be equal'() {
|
|
7797
|
+
$mol_assert_equal(2, 2);
|
|
7770
7798
|
},
|
|
7771
|
-
'
|
|
7772
|
-
|
|
7773
|
-
"hello",
|
|
7774
|
-
$mol_jsx("strong", null, "world"),
|
|
7775
|
-
"!");
|
|
7776
|
-
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
7799
|
+
'three must be equal'() {
|
|
7800
|
+
$mol_assert_equal(2, 2, 2);
|
|
7777
7801
|
},
|
|
7778
|
-
'
|
|
7779
|
-
|
|
7780
|
-
$mol_jsx("br", null),
|
|
7781
|
-
$mol_jsx("hr", null));
|
|
7782
|
-
$mol_assert_equal($mol_dom_serialize(dom), '<br xmlns="http://www.w3.org/1999/xhtml" /><hr xmlns="http://www.w3.org/1999/xhtml" />');
|
|
7802
|
+
'two must be unique'() {
|
|
7803
|
+
$mol_assert_unique([2], [3]);
|
|
7783
7804
|
},
|
|
7784
|
-
'
|
|
7785
|
-
|
|
7786
|
-
$mol_jsx($mol_jsx_frag, null,
|
|
7787
|
-
$mol_jsx("br", null),
|
|
7788
|
-
$mol_jsx("hr", null)));
|
|
7789
|
-
$mol_assert_equal(dom.outerHTML, '<div><br><hr></div>');
|
|
7805
|
+
'three must be unique'() {
|
|
7806
|
+
$mol_assert_unique([1], [2], [3]);
|
|
7790
7807
|
},
|
|
7791
|
-
'
|
|
7792
|
-
|
|
7793
|
-
return $mol_jsx("button", { title: props.hint }, target());
|
|
7794
|
-
};
|
|
7795
|
-
const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
|
|
7796
|
-
$mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
|
|
7808
|
+
'two must be alike'() {
|
|
7809
|
+
$mol_assert_equal([3], [3]);
|
|
7797
7810
|
},
|
|
7798
|
-
'
|
|
7799
|
-
|
|
7800
|
-
return $mol_jsx("div", null,
|
|
7801
|
-
$mol_jsx(Bar, { id: "bar" },
|
|
7802
|
-
$mol_jsx("img", { id: "icon" })));
|
|
7803
|
-
};
|
|
7804
|
-
const Bar = (props, icon) => {
|
|
7805
|
-
return $mol_jsx("span", null,
|
|
7806
|
-
icon,
|
|
7807
|
-
$mol_jsx("i", { id: "label" }));
|
|
7808
|
-
};
|
|
7809
|
-
const dom = $mol_jsx(Foo, { id: "foo" });
|
|
7810
|
-
$mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></span></div>');
|
|
7811
|
+
'three must be alike'() {
|
|
7812
|
+
$mol_assert_equal([3], [3], [3]);
|
|
7811
7813
|
},
|
|
7812
|
-
'
|
|
7813
|
-
|
|
7814
|
-
return $mol_jsx("div", null,
|
|
7815
|
-
$mol_jsx("span", { id: "bar" }),
|
|
7816
|
-
$mol_jsx("span", { id: "bar" }));
|
|
7817
|
-
};
|
|
7818
|
-
$mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
|
|
7814
|
+
'two object must be alike'() {
|
|
7815
|
+
$mol_assert_equal({ a: 1 }, { a: 1 });
|
|
7819
7816
|
},
|
|
7820
|
-
'
|
|
7821
|
-
|
|
7822
|
-
return $mol_jsx("div", null,
|
|
7823
|
-
$mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
7824
|
-
};
|
|
7825
|
-
const Bar = (props) => {
|
|
7826
|
-
return $mol_jsx("span", null, props.icon());
|
|
7827
|
-
};
|
|
7828
|
-
const dom = $mol_jsx(Foo, { id: "app" });
|
|
7829
|
-
$mol_assert_equal(dom.outerHTML, '<div id="app" class="Foo"><span id="app/middle" class="Foo_middle Bar"><img id="app/icon" class="Foo_icon"></span></div>');
|
|
7817
|
+
'three object must be alike'() {
|
|
7818
|
+
$mol_assert_equal({ a: 1 }, { a: 1 }, { a: 1 });
|
|
7830
7819
|
},
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
$
|
|
7820
|
+
});
|
|
7821
|
+
})($ || ($ = {}));
|
|
7822
|
+
|
|
7823
|
+
;
|
|
7824
|
+
"use strict";
|
|
7825
|
+
var $;
|
|
7826
|
+
(function ($) {
|
|
7827
|
+
$mol_test({
|
|
7828
|
+
'return result without errors'() {
|
|
7829
|
+
$mol_assert_equal($mol_try(() => false), false);
|
|
7841
7830
|
},
|
|
7842
7831
|
});
|
|
7843
7832
|
})($ || ($ = {}));
|
|
7844
7833
|
|
|
7834
|
+
;
|
|
7835
|
+
"use strict";
|
|
7836
|
+
var $;
|
|
7837
|
+
(function ($_1) {
|
|
7838
|
+
$mol_test_mocks.push($ => $.$mol_fail_log = () => false);
|
|
7839
|
+
})($ || ($ = {}));
|
|
7840
|
+
|
|
7841
|
+
;
|
|
7842
|
+
"use strict";
|
|
7843
|
+
var $;
|
|
7844
|
+
(function ($_1) {
|
|
7845
|
+
$mol_test_mocks.push($ => {
|
|
7846
|
+
$.$mol_log3_come = () => { };
|
|
7847
|
+
$.$mol_log3_done = () => { };
|
|
7848
|
+
$.$mol_log3_fail = () => { };
|
|
7849
|
+
$.$mol_log3_warn = () => { };
|
|
7850
|
+
$.$mol_log3_rise = () => { };
|
|
7851
|
+
$.$mol_log3_area = () => () => { };
|
|
7852
|
+
});
|
|
7853
|
+
})($ || ($ = {}));
|
|
7854
|
+
|
|
7855
|
+
;
|
|
7856
|
+
"use strict";
|
|
7857
|
+
|
|
7858
|
+
;
|
|
7859
|
+
"use strict";
|
|
7860
|
+
|
|
7861
|
+
;
|
|
7862
|
+
"use strict";
|
|
7863
|
+
|
|
7864
|
+
;
|
|
7865
|
+
"use strict";
|
|
7866
|
+
|
|
7845
7867
|
;
|
|
7846
7868
|
"use strict";
|
|
7847
7869
|
var $;
|
|
7848
7870
|
(function ($) {
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
value: size(),
|
|
7880
|
-
writable: true,
|
|
7881
|
-
enumerable: false,
|
|
7882
|
-
configurable: false,
|
|
7883
|
-
};
|
|
7884
|
-
const index = Number(field);
|
|
7885
|
-
if (index === Math.trunc(index))
|
|
7886
|
-
return {
|
|
7887
|
-
get: () => this.get(target, field, this),
|
|
7888
|
-
enumerable: true,
|
|
7889
|
-
configurable: true,
|
|
7890
|
-
};
|
|
7891
|
-
return Object.getOwnPropertyDescriptor(target, field);
|
|
7892
|
-
}
|
|
7893
|
-
});
|
|
7894
|
-
}
|
|
7895
|
-
$.$mol_range2 = $mol_range2;
|
|
7896
|
-
class $mol_range2_array extends Array {
|
|
7897
|
-
concat(...tail) {
|
|
7898
|
-
if (tail.length === 0)
|
|
7899
|
-
return this;
|
|
7900
|
-
if (tail.length > 1) {
|
|
7901
|
-
let list = this;
|
|
7902
|
-
for (let item of tail)
|
|
7903
|
-
list = list.concat(item);
|
|
7904
|
-
return list;
|
|
7905
|
-
}
|
|
7906
|
-
return $mol_range2(index => index < this.length ? this[index] : tail[0][index - this.length], () => this.length + tail[0].length);
|
|
7907
|
-
}
|
|
7908
|
-
filter(check, context) {
|
|
7909
|
-
const filtered = [];
|
|
7910
|
-
let cursor = -1;
|
|
7911
|
-
return $mol_range2(index => {
|
|
7912
|
-
while (cursor < this.length && index >= filtered.length - 1) {
|
|
7913
|
-
const val = this[++cursor];
|
|
7914
|
-
if (check(val, cursor, this))
|
|
7915
|
-
filtered.push(val);
|
|
7916
|
-
}
|
|
7917
|
-
return filtered[index];
|
|
7918
|
-
}, () => cursor < this.length ? Number.POSITIVE_INFINITY : filtered.length);
|
|
7919
|
-
}
|
|
7920
|
-
forEach(proceed, context) {
|
|
7921
|
-
for (let [key, value] of this.entries())
|
|
7922
|
-
proceed.call(context, value, key, this);
|
|
7923
|
-
}
|
|
7924
|
-
map(proceed, context) {
|
|
7925
|
-
return $mol_range2(index => proceed.call(context, this[index], index, this), () => this.length);
|
|
7926
|
-
}
|
|
7927
|
-
reduce(merge, result) {
|
|
7928
|
-
let index = 0;
|
|
7929
|
-
if (arguments.length === 1) {
|
|
7930
|
-
result = this[index++];
|
|
7871
|
+
$mol_test({
|
|
7872
|
+
'get'() {
|
|
7873
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
7874
|
+
$mol_assert_equal(proxy.foo, 777);
|
|
7875
|
+
},
|
|
7876
|
+
'has'() {
|
|
7877
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
7878
|
+
$mol_assert_equal('foo' in proxy, true);
|
|
7879
|
+
},
|
|
7880
|
+
'set'() {
|
|
7881
|
+
const target = { foo: 777 };
|
|
7882
|
+
const proxy = $mol_delegate({}, () => target);
|
|
7883
|
+
proxy.foo = 123;
|
|
7884
|
+
$mol_assert_equal(target.foo, 123);
|
|
7885
|
+
},
|
|
7886
|
+
'getOwnPropertyDescriptor'() {
|
|
7887
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
7888
|
+
$mol_assert_like(Object.getOwnPropertyDescriptor(proxy, 'foo'), {
|
|
7889
|
+
value: 777,
|
|
7890
|
+
writable: true,
|
|
7891
|
+
enumerable: true,
|
|
7892
|
+
configurable: true,
|
|
7893
|
+
});
|
|
7894
|
+
},
|
|
7895
|
+
'ownKeys'() {
|
|
7896
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777, [Symbol.toStringTag]: 'bar' }));
|
|
7897
|
+
$mol_assert_like(Reflect.ownKeys(proxy), ['foo', Symbol.toStringTag]);
|
|
7898
|
+
},
|
|
7899
|
+
'getPrototypeOf'() {
|
|
7900
|
+
class Foo {
|
|
7931
7901
|
}
|
|
7932
|
-
|
|
7933
|
-
|
|
7902
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
7903
|
+
$mol_assert_equal(Object.getPrototypeOf(proxy), Foo.prototype);
|
|
7904
|
+
},
|
|
7905
|
+
'setPrototypeOf'() {
|
|
7906
|
+
class Foo {
|
|
7934
7907
|
}
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
}
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
}
|
|
7943
|
-
some(check, context) {
|
|
7944
|
-
for (let index = 0; index < this.length; ++index) {
|
|
7945
|
-
if (check.call(context, this[index], index, this))
|
|
7946
|
-
return true;
|
|
7908
|
+
const target = {};
|
|
7909
|
+
const proxy = $mol_delegate({}, () => target);
|
|
7910
|
+
Object.setPrototypeOf(proxy, Foo.prototype);
|
|
7911
|
+
$mol_assert_equal(Object.getPrototypeOf(target), Foo.prototype);
|
|
7912
|
+
},
|
|
7913
|
+
'instanceof'() {
|
|
7914
|
+
class Foo {
|
|
7947
7915
|
}
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7916
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
7917
|
+
$mol_assert_ok(proxy instanceof Foo);
|
|
7918
|
+
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
7919
|
+
},
|
|
7920
|
+
'autobind'() {
|
|
7921
|
+
class Foo {
|
|
7954
7922
|
}
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
sort() {
|
|
7961
|
-
return $mol_fail(new TypeError(`Mutable sort is forbidden. Use toSorted instead.`));
|
|
7962
|
-
}
|
|
7963
|
-
indexOf(needle) {
|
|
7964
|
-
return this.findIndex(item => item === needle);
|
|
7965
|
-
}
|
|
7966
|
-
[Symbol.toPrimitive]() {
|
|
7967
|
-
return $mol_guid();
|
|
7968
|
-
}
|
|
7969
|
-
}
|
|
7970
|
-
$.$mol_range2_array = $mol_range2_array;
|
|
7923
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
7924
|
+
$mol_assert_ok(proxy instanceof Foo);
|
|
7925
|
+
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
7926
|
+
},
|
|
7927
|
+
});
|
|
7971
7928
|
})($ || ($ = {}));
|
|
7972
7929
|
|
|
7973
7930
|
;
|
|
7974
7931
|
"use strict";
|
|
7975
7932
|
var $;
|
|
7976
|
-
(function ($) {
|
|
7933
|
+
(function ($_1) {
|
|
7977
7934
|
$mol_test({
|
|
7978
|
-
'
|
|
7979
|
-
|
|
7980
|
-
const
|
|
7981
|
-
$mol_assert_equal(
|
|
7982
|
-
$mol_assert_equal(
|
|
7983
|
-
$mol_assert_equal(
|
|
7984
|
-
$mol_assert_equal(
|
|
7985
|
-
$mol_assert_equal(list[9], 9);
|
|
7986
|
-
$mol_assert_equal(list[9.5], undefined);
|
|
7987
|
-
$mol_assert_equal(list[10], undefined);
|
|
7988
|
-
$mol_assert_equal(calls, 2);
|
|
7989
|
-
},
|
|
7990
|
-
'infinity list'() {
|
|
7991
|
-
let calls = 0;
|
|
7992
|
-
const list = $mol_range2(index => (++calls, index));
|
|
7993
|
-
$mol_assert_equal(list.length, Number.POSITIVE_INFINITY);
|
|
7994
|
-
$mol_assert_equal(list[0], 0);
|
|
7995
|
-
$mol_assert_equal(list[4], 4);
|
|
7996
|
-
$mol_assert_equal(list[Number.MAX_SAFE_INTEGER], Number.MAX_SAFE_INTEGER);
|
|
7997
|
-
$mol_assert_equal(list[Number.POSITIVE_INFINITY], undefined);
|
|
7998
|
-
$mol_assert_equal(calls, 3);
|
|
7935
|
+
'span for same uri'($) {
|
|
7936
|
+
const span = new $mol_span('test.ts', '', 1, 3, 4);
|
|
7937
|
+
const child = span.span(4, 5, 8);
|
|
7938
|
+
$mol_assert_equal(child.uri, 'test.ts');
|
|
7939
|
+
$mol_assert_equal(child.row, 4);
|
|
7940
|
+
$mol_assert_equal(child.col, 5);
|
|
7941
|
+
$mol_assert_equal(child.length, 8);
|
|
7999
7942
|
},
|
|
8000
|
-
'
|
|
8001
|
-
const
|
|
8002
|
-
|
|
8003
|
-
$mol_assert_equal(
|
|
7943
|
+
'span after of given position'($) {
|
|
7944
|
+
const span = new $mol_span('test.ts', '', 1, 3, 4);
|
|
7945
|
+
const child = span.after(11);
|
|
7946
|
+
$mol_assert_equal(child.uri, 'test.ts');
|
|
7947
|
+
$mol_assert_equal(child.row, 1);
|
|
7948
|
+
$mol_assert_equal(child.col, 7);
|
|
7949
|
+
$mol_assert_equal(child.length, 11);
|
|
8004
7950
|
},
|
|
8005
|
-
'
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
$mol_assert_equal(
|
|
7951
|
+
'slice span - regular'($) {
|
|
7952
|
+
const span = new $mol_span('test.ts', '', 1, 3, 5);
|
|
7953
|
+
const child = span.slice(1, 4);
|
|
7954
|
+
$mol_assert_equal(child.row, 1);
|
|
7955
|
+
$mol_assert_equal(child.col, 4);
|
|
7956
|
+
$mol_assert_equal(child.length, 3);
|
|
7957
|
+
const child2 = span.slice(2, 2);
|
|
7958
|
+
$mol_assert_equal(child2.col, 5);
|
|
7959
|
+
$mol_assert_equal(child2.length, 0);
|
|
8011
7960
|
},
|
|
8012
|
-
'
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
$mol_assert_equal(
|
|
7961
|
+
'slice span - negative'($) {
|
|
7962
|
+
const span = new $mol_span('test.ts', '', 1, 3, 5);
|
|
7963
|
+
const child = span.slice(-3, -1);
|
|
7964
|
+
$mol_assert_equal(child.row, 1);
|
|
7965
|
+
$mol_assert_equal(child.col, 5);
|
|
7966
|
+
$mol_assert_equal(child.length, 2);
|
|
8018
7967
|
},
|
|
8019
|
-
'
|
|
8020
|
-
|
|
8021
|
-
$
|
|
8022
|
-
$
|
|
7968
|
+
'slice span - out of range'($) {
|
|
7969
|
+
const span = new $mol_span('test.ts', '', 1, 3, 5);
|
|
7970
|
+
$mol_assert_fail(() => span.slice(-1, 3), `End value '3' can't be less than begin value (test.ts#1:3/5)`);
|
|
7971
|
+
$mol_assert_fail(() => span.slice(1, 6), `End value '6' out of range (test.ts#1:3/5)`);
|
|
7972
|
+
$mol_assert_fail(() => span.slice(1, 10), `End value '10' out of range (test.ts#1:3/5)`);
|
|
8023
7973
|
},
|
|
8024
|
-
'
|
|
8025
|
-
|
|
8026
|
-
const
|
|
8027
|
-
$mol_assert_equal(
|
|
8028
|
-
|
|
7974
|
+
'error handling'($) {
|
|
7975
|
+
const span = new $mol_span('test.ts', '', 1, 3, 4);
|
|
7976
|
+
const error = span.error('Some error');
|
|
7977
|
+
$mol_assert_equal(error.message, 'Some error (test.ts#1:3/4)');
|
|
7978
|
+
}
|
|
7979
|
+
});
|
|
7980
|
+
})($ || ($ = {}));
|
|
7981
|
+
|
|
7982
|
+
;
|
|
7983
|
+
"use strict";
|
|
7984
|
+
var $;
|
|
7985
|
+
(function ($) {
|
|
7986
|
+
$mol_test({
|
|
7987
|
+
'all cases of using maybe'() {
|
|
7988
|
+
$mol_assert_equal($mol_maybe(0)[0], 0);
|
|
7989
|
+
$mol_assert_equal($mol_maybe(false)[0], false);
|
|
7990
|
+
$mol_assert_equal($mol_maybe(null)[0], void 0);
|
|
7991
|
+
$mol_assert_equal($mol_maybe(void 0)[0], void 0);
|
|
7992
|
+
$mol_assert_equal($mol_maybe(void 0).map(v => v.toString())[0], void 0);
|
|
7993
|
+
$mol_assert_equal($mol_maybe(0).map(v => v.toString())[0], '0');
|
|
8029
7994
|
},
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
$mol_assert_equal(target[4], 14);
|
|
8079
|
-
$mol_assert_equal(target[5], undefined);
|
|
8080
|
-
$mol_assert_equal(calls1, 2);
|
|
8081
|
-
$mol_assert_equal(calls2, 2);
|
|
8082
|
-
},
|
|
8083
|
-
'lazy slice'() {
|
|
8084
|
-
let calls = 0;
|
|
8085
|
-
const list = $mol_range2(index => (++calls, index), () => 10).slice(3, 7);
|
|
8086
|
-
$mol_assert_equal(true, list instanceof Array);
|
|
8087
|
-
$mol_assert_equal(list.length, 4);
|
|
8088
|
-
$mol_assert_equal(list[0], 3);
|
|
8089
|
-
$mol_assert_equal(list[3], 6);
|
|
8090
|
-
$mol_assert_equal(list[4], undefined);
|
|
8091
|
-
$mol_assert_equal(calls, 2);
|
|
7995
|
+
});
|
|
7996
|
+
})($ || ($ = {}));
|
|
7997
|
+
|
|
7998
|
+
;
|
|
7999
|
+
"use strict";
|
|
8000
|
+
var $;
|
|
8001
|
+
(function ($_1) {
|
|
8002
|
+
function check(tree, ideal) {
|
|
8003
|
+
$mol_assert_equal(tree.toString(), $$.$mol_tree2_from_string(ideal).toString());
|
|
8004
|
+
}
|
|
8005
|
+
$mol_test({
|
|
8006
|
+
'inserting'($) {
|
|
8007
|
+
check($.$mol_tree2_from_string(`
|
|
8008
|
+
a b c d
|
|
8009
|
+
`).insert($mol_tree2.struct('x'), 'a', 'b', 'c'), `
|
|
8010
|
+
a b x
|
|
8011
|
+
`);
|
|
8012
|
+
check($.$mol_tree2_from_string(`
|
|
8013
|
+
a b
|
|
8014
|
+
`).insert($mol_tree2.struct('x'), 'a', 'b', 'c', 'd'), `
|
|
8015
|
+
a b c x
|
|
8016
|
+
`);
|
|
8017
|
+
check($.$mol_tree2_from_string(`
|
|
8018
|
+
a b c d
|
|
8019
|
+
`)
|
|
8020
|
+
.insert($mol_tree2.struct('x'), 0, 0, 0), `
|
|
8021
|
+
a b x
|
|
8022
|
+
`);
|
|
8023
|
+
check($.$mol_tree2_from_string(`
|
|
8024
|
+
a b
|
|
8025
|
+
`)
|
|
8026
|
+
.insert($mol_tree2.struct('x'), 0, 0, 0, 0), `
|
|
8027
|
+
a b \\
|
|
8028
|
+
x
|
|
8029
|
+
`);
|
|
8030
|
+
check($.$mol_tree2_from_string(`
|
|
8031
|
+
a b c d
|
|
8032
|
+
`)
|
|
8033
|
+
.insert($mol_tree2.struct('x'), null, null, null), `
|
|
8034
|
+
a b x
|
|
8035
|
+
`);
|
|
8036
|
+
check($.$mol_tree2_from_string(`
|
|
8037
|
+
a b
|
|
8038
|
+
`)
|
|
8039
|
+
.insert($mol_tree2.struct('x'), null, null, null, null), `
|
|
8040
|
+
a b \\
|
|
8041
|
+
x
|
|
8042
|
+
`);
|
|
8092
8043
|
},
|
|
8093
|
-
'
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8044
|
+
'updating'($) {
|
|
8045
|
+
check($.$mol_tree2_from_string(`
|
|
8046
|
+
a b c d
|
|
8047
|
+
`).update([], 'a', 'b', 'c')[0], `
|
|
8048
|
+
a b
|
|
8049
|
+
`);
|
|
8050
|
+
check($.$mol_tree2_from_string(`
|
|
8051
|
+
a b c d
|
|
8052
|
+
`).update([$mol_tree2.struct('x')])[0], `
|
|
8053
|
+
x
|
|
8054
|
+
`);
|
|
8055
|
+
check($.$mol_tree2_from_string(`
|
|
8056
|
+
a b c d
|
|
8057
|
+
`).update([$mol_tree2.struct('x'), $mol_tree2.struct('y')], 'a', 'b', 'c')[0], `
|
|
8058
|
+
a b
|
|
8059
|
+
x
|
|
8060
|
+
y
|
|
8061
|
+
`);
|
|
8099
8062
|
},
|
|
8100
|
-
'
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8063
|
+
'deleting'($) {
|
|
8064
|
+
const base = $.$mol_tree2_from_string(`
|
|
8065
|
+
a b c d
|
|
8066
|
+
`);
|
|
8067
|
+
check(base.insert(null, 'a', 'b', 'c'), `
|
|
8068
|
+
a b
|
|
8069
|
+
`);
|
|
8070
|
+
check(base.update(base.select('a', 'b', 'c', null).kids, 'a', 'b', 'c')[0], `
|
|
8071
|
+
a b d
|
|
8072
|
+
`);
|
|
8073
|
+
check(base.insert(null, 0, 0, 0), `
|
|
8074
|
+
a b
|
|
8075
|
+
`);
|
|
8106
8076
|
},
|
|
8107
|
-
'
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
$mol_assert_equal(
|
|
8115
|
-
$mol_assert_equal(list[4], undefined);
|
|
8116
|
-
$mol_assert_equal(calls, 2);
|
|
8077
|
+
'hack'($) {
|
|
8078
|
+
const res = $.$mol_tree2_from_string(`
|
|
8079
|
+
foo bar xxx
|
|
8080
|
+
`)
|
|
8081
|
+
.hack({
|
|
8082
|
+
'bar': (input, belt) => [input.struct('777', input.hack(belt))],
|
|
8083
|
+
});
|
|
8084
|
+
$mol_assert_equal(res.map(String), ['foo 777 xxx\n']);
|
|
8117
8085
|
},
|
|
8118
|
-
'prevent modification'() {
|
|
8119
|
-
const list = $mol_range2(i => i, () => 5);
|
|
8120
|
-
$mol_assert_fail(() => list.push(4), TypeError);
|
|
8121
|
-
$mol_assert_fail(() => list.pop(), TypeError);
|
|
8122
|
-
$mol_assert_fail(() => list.unshift(4), TypeError);
|
|
8123
|
-
$mol_assert_fail(() => list.shift(), TypeError);
|
|
8124
|
-
$mol_assert_fail(() => list.splice(1, 2), TypeError);
|
|
8125
|
-
$mol_assert_fail(() => list[1] = 2, TypeError);
|
|
8126
|
-
$mol_assert_fail(() => list.reverse(), TypeError);
|
|
8127
|
-
$mol_assert_fail(() => list.sort(), TypeError);
|
|
8128
|
-
$mol_assert_equal(list.toString(), '0,1,2,3,4');
|
|
8129
|
-
}
|
|
8130
8086
|
});
|
|
8131
8087
|
})($ || ($ = {}));
|
|
8132
8088
|
|
|
8133
8089
|
;
|
|
8134
8090
|
"use strict";
|
|
8135
8091
|
var $;
|
|
8136
|
-
(function ($) {
|
|
8092
|
+
(function ($_1) {
|
|
8137
8093
|
$mol_test({
|
|
8138
|
-
'
|
|
8139
|
-
$
|
|
8140
|
-
$
|
|
8141
|
-
$
|
|
8142
|
-
$
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
$
|
|
8146
|
-
$
|
|
8147
|
-
$mol_assert_not($mol_compare_deep(1, 2));
|
|
8148
|
-
$mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
|
|
8149
|
-
$mol_assert_not($mol_compare_deep(Object(1), Object(2)));
|
|
8094
|
+
'tree parsing'($) {
|
|
8095
|
+
$mol_assert_equal($.$mol_tree2_from_string("foo\nbar\n").kids.length, 2);
|
|
8096
|
+
$mol_assert_equal($.$mol_tree2_from_string("foo\nbar\n").kids[1].type, "bar");
|
|
8097
|
+
$mol_assert_equal($.$mol_tree2_from_string("foo\n\n\n").kids.length, 1);
|
|
8098
|
+
$mol_assert_equal($.$mol_tree2_from_string("=foo\n\\bar\n").kids.length, 2);
|
|
8099
|
+
$mol_assert_equal($.$mol_tree2_from_string("=foo\n\\bar\n").kids[1].value, "bar");
|
|
8100
|
+
$mol_assert_equal($.$mol_tree2_from_string("foo bar \\pol\n").kids[0].kids[0].kids[0].value, "pol");
|
|
8101
|
+
$mol_assert_equal($.$mol_tree2_from_string("foo bar\n\t\\pol\n\t\\men\n").kids[0].kids[0].kids[1].value, "men");
|
|
8102
|
+
$mol_assert_equal($.$mol_tree2_from_string('foo bar \\text\n').toString(), 'foo bar \\text\n');
|
|
8150
8103
|
},
|
|
8151
|
-
'
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
$
|
|
8157
|
-
|
|
8158
|
-
|
|
8104
|
+
'Too many tabs'($) {
|
|
8105
|
+
const tree = `
|
|
8106
|
+
foo
|
|
8107
|
+
bar
|
|
8108
|
+
`;
|
|
8109
|
+
$mol_assert_fail(() => {
|
|
8110
|
+
$.$mol_tree2_from_string(tree, 'test');
|
|
8111
|
+
}, 'Too many tabs\ntest#3:1/6\n!!!!!!\n\t\t\t\t\t\tbar');
|
|
8159
8112
|
},
|
|
8160
|
-
'
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
$
|
|
8166
|
-
|
|
8113
|
+
'Too few tabs'($) {
|
|
8114
|
+
const tree = `
|
|
8115
|
+
foo
|
|
8116
|
+
bar
|
|
8117
|
+
`;
|
|
8118
|
+
$mol_assert_fail(() => {
|
|
8119
|
+
$.$mol_tree2_from_string(tree, 'test');
|
|
8120
|
+
}, 'Too few tabs\ntest#3:1/4\n!!!!\n\t\t\t\tbar');
|
|
8167
8121
|
},
|
|
8168
|
-
'
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
8122
|
+
'Wrong nodes separator at start'($) {
|
|
8123
|
+
const tree = `foo\n \tbar\n`;
|
|
8124
|
+
$mol_assert_fail(() => {
|
|
8125
|
+
$.$mol_tree2_from_string(tree, 'test');
|
|
8126
|
+
}, 'Wrong nodes separator\ntest#2:1/2\n!!\n \tbar');
|
|
8174
8127
|
},
|
|
8175
|
-
'
|
|
8176
|
-
const
|
|
8177
|
-
$
|
|
8178
|
-
|
|
8128
|
+
'Wrong nodes separator in the middle'($) {
|
|
8129
|
+
const tree = `foo bar\n`;
|
|
8130
|
+
$mol_assert_fail(() => {
|
|
8131
|
+
$.$mol_tree2_from_string(tree, 'test');
|
|
8132
|
+
}, 'Wrong nodes separator\ntest#1:5/1\n !\nfoo bar');
|
|
8179
8133
|
},
|
|
8180
|
-
'
|
|
8181
|
-
const
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
$mol_assert_ok($mol_compare_deep(a, b));
|
|
8134
|
+
'Unexpected EOF, LF required'($) {
|
|
8135
|
+
const tree = ` foo`;
|
|
8136
|
+
$mol_assert_fail(() => {
|
|
8137
|
+
$.$mol_tree2_from_string(tree, 'test');
|
|
8138
|
+
}, 'Unexpected EOF, LF required\ntest#1:5/1\n !\n foo');
|
|
8186
8139
|
},
|
|
8187
|
-
'
|
|
8188
|
-
const
|
|
8189
|
-
const
|
|
8190
|
-
const
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
obj1.obj3 = obj3;
|
|
8195
|
-
obj1_copy.obj3 = obj3_copy;
|
|
8196
|
-
$mol_assert_not($mol_compare_deep(obj1, {}));
|
|
8197
|
-
$mol_assert_not($mol_compare_deep(obj2, {}));
|
|
8198
|
-
$mol_assert_not($mol_compare_deep(obj3, {}));
|
|
8199
|
-
$mol_assert_ok($mol_compare_deep(obj3, obj3_copy));
|
|
8200
|
-
},
|
|
8201
|
-
'Date'() {
|
|
8202
|
-
$mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
|
|
8203
|
-
$mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));
|
|
8204
|
-
},
|
|
8205
|
-
'RegExp'() {
|
|
8206
|
-
$mol_assert_ok($mol_compare_deep(/\x22/mig, /\x22/mig));
|
|
8207
|
-
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x21/mig));
|
|
8208
|
-
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x22/mg));
|
|
8209
|
-
},
|
|
8210
|
-
'Error'() {
|
|
8211
|
-
$mol_assert_not($mol_compare_deep(new Error('xxx'), new Error('xxx')));
|
|
8212
|
-
const fail = (message) => new Error(message);
|
|
8213
|
-
$mol_assert_ok($mol_compare_deep(...['xxx', 'xxx'].map(msg => new Error(msg))));
|
|
8214
|
-
$mol_assert_not($mol_compare_deep(...['xxx', 'yyy'].map(msg => new Error(msg))));
|
|
8215
|
-
},
|
|
8216
|
-
'Map'() {
|
|
8217
|
-
$mol_assert_ok($mol_compare_deep(new Map, new Map));
|
|
8218
|
-
$mol_assert_ok($mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
|
|
8219
|
-
$mol_assert_ok($mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
|
|
8220
|
-
$mol_assert_not($mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
|
|
8221
|
-
$mol_assert_not($mol_compare_deep(new Map([[[1], 2]]), new Map([[[3], 2]])));
|
|
8222
|
-
},
|
|
8223
|
-
'Set'() {
|
|
8224
|
-
$mol_assert_ok($mol_compare_deep(new Set, new Set));
|
|
8225
|
-
$mol_assert_ok($mol_compare_deep(new Set([1, [2]]), new Set([1, [2]])));
|
|
8226
|
-
$mol_assert_not($mol_compare_deep(new Set([1]), new Set([2])));
|
|
8227
|
-
},
|
|
8228
|
-
'Uint8Array'() {
|
|
8229
|
-
$mol_assert_ok($mol_compare_deep(new Uint8Array, new Uint8Array));
|
|
8230
|
-
$mol_assert_ok($mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
|
|
8231
|
-
$mol_assert_not($mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
|
|
8232
|
-
},
|
|
8233
|
-
'DataView'() {
|
|
8234
|
-
$mol_assert_ok($mol_compare_deep(new DataView(new Uint8Array().buffer), new DataView(new Uint8Array().buffer)));
|
|
8235
|
-
$mol_assert_ok($mol_compare_deep(new DataView(new Uint8Array([0]).buffer), new DataView(new Uint8Array([0]).buffer)));
|
|
8236
|
-
$mol_assert_not($mol_compare_deep(new DataView(new Uint8Array([0]).buffer), new DataView(new Uint8Array([1]).buffer)));
|
|
8237
|
-
},
|
|
8238
|
-
'Serializale'() {
|
|
8239
|
-
class User {
|
|
8240
|
-
name;
|
|
8241
|
-
rand;
|
|
8242
|
-
constructor(name, rand = Math.random()) {
|
|
8243
|
-
this.name = name;
|
|
8244
|
-
this.rand = rand;
|
|
8245
|
-
}
|
|
8246
|
-
[Symbol.toPrimitive](mode) {
|
|
8247
|
-
return this.name;
|
|
8140
|
+
'Errors skip and collect'($) {
|
|
8141
|
+
const tree = `foo bar`;
|
|
8142
|
+
const errors = [];
|
|
8143
|
+
const $$ = $.$mol_ambient({
|
|
8144
|
+
$mol_fail: (error) => {
|
|
8145
|
+
errors.push(error.message);
|
|
8146
|
+
return null;
|
|
8248
8147
|
}
|
|
8249
|
-
}
|
|
8250
|
-
|
|
8251
|
-
$
|
|
8252
|
-
|
|
8253
|
-
'
|
|
8254
|
-
|
|
8255
|
-
$
|
|
8256
|
-
$mol_assert_not($mol_compare_deep(new URLSearchParams({ foo: 'xxx', bar: 'yyy' }), new URLSearchParams({ bar: 'yyy', foo: 'xxx' })));
|
|
8148
|
+
});
|
|
8149
|
+
const res = $$.$mol_tree2_from_string(tree, 'test');
|
|
8150
|
+
$mol_assert_like(errors, [
|
|
8151
|
+
'Wrong nodes separator\ntest#1:5/1\n !\nfoo bar',
|
|
8152
|
+
'Unexpected EOF, LF required\ntest#1:9/1\n !\nfoo bar',
|
|
8153
|
+
]);
|
|
8154
|
+
$mol_assert_equal(res.toString(), 'foo bar\n');
|
|
8257
8155
|
},
|
|
8258
8156
|
});
|
|
8259
8157
|
})($ || ($ = {}));
|
|
@@ -8262,100 +8160,61 @@ var $;
|
|
|
8262
8160
|
"use strict";
|
|
8263
8161
|
var $;
|
|
8264
8162
|
(function ($) {
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
}
|
|
8276
|
-
$.$mol_assert_not = $mol_assert_not;
|
|
8277
|
-
function $mol_assert_fail(handler, ErrorRight) {
|
|
8278
|
-
const fail = $.$mol_fail;
|
|
8279
|
-
try {
|
|
8280
|
-
$.$mol_fail = $.$mol_fail_hidden;
|
|
8281
|
-
handler();
|
|
8282
|
-
}
|
|
8283
|
-
catch (error) {
|
|
8284
|
-
$.$mol_fail = fail;
|
|
8285
|
-
if (typeof ErrorRight === 'string') {
|
|
8286
|
-
$mol_assert_equal(error.message ?? error, ErrorRight);
|
|
8287
|
-
}
|
|
8288
|
-
else {
|
|
8289
|
-
$mol_assert_equal(error instanceof ErrorRight, true);
|
|
8290
|
-
}
|
|
8291
|
-
return error;
|
|
8292
|
-
}
|
|
8293
|
-
finally {
|
|
8294
|
-
$.$mol_fail = fail;
|
|
8295
|
-
}
|
|
8296
|
-
$mol_fail(new Error('Not failed'));
|
|
8297
|
-
}
|
|
8298
|
-
$.$mol_assert_fail = $mol_assert_fail;
|
|
8299
|
-
function $mol_assert_like(...args) {
|
|
8300
|
-
$mol_assert_equal(...args);
|
|
8301
|
-
}
|
|
8302
|
-
$.$mol_assert_like = $mol_assert_like;
|
|
8303
|
-
function $mol_assert_unique(...args) {
|
|
8304
|
-
for (let i = 0; i < args.length; ++i) {
|
|
8305
|
-
for (let j = 0; j < args.length; ++j) {
|
|
8306
|
-
if (i === j)
|
|
8307
|
-
continue;
|
|
8308
|
-
if (!$mol_compare_deep(args[i], args[j]))
|
|
8309
|
-
continue;
|
|
8310
|
-
return $mol_fail(new Error(`Uniquesess assertion failure`, { cause: { [i]: args[i], [i]: args[i] } }));
|
|
8311
|
-
}
|
|
8312
|
-
}
|
|
8313
|
-
}
|
|
8314
|
-
$.$mol_assert_unique = $mol_assert_unique;
|
|
8315
|
-
function $mol_assert_equal(...args) {
|
|
8316
|
-
for (let i = 1; i < args.length; ++i) {
|
|
8317
|
-
if ($mol_compare_deep(args[0], args[i]))
|
|
8318
|
-
continue;
|
|
8319
|
-
return $mol_fail(new Error(`Equality assertion failure`, { cause: { 0: args[0], [i]: args[i] } }));
|
|
8320
|
-
}
|
|
8321
|
-
}
|
|
8322
|
-
$.$mol_assert_equal = $mol_assert_equal;
|
|
8163
|
+
$mol_test({
|
|
8164
|
+
'fromJSON'() {
|
|
8165
|
+
$mol_assert_equal($mol_tree2_from_json([]).toString(), '/\n');
|
|
8166
|
+
$mol_assert_equal($mol_tree2_from_json([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
|
|
8167
|
+
$mol_assert_equal($mol_tree2_from_json([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
|
|
8168
|
+
$mol_assert_equal($mol_tree2_from_json(new Uint16Array([1, 10, 256])).toString(), '\\\x01\x00\n\\\x00\x00\x01\n');
|
|
8169
|
+
$mol_assert_equal($mol_tree2_from_json(['', 'foo', 'bar\nbaz']).toString(), '/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n');
|
|
8170
|
+
$mol_assert_equal($mol_tree2_from_json({ 'foo': false, 'bar\nbaz': 'lol' }).toString(), '*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n');
|
|
8171
|
+
},
|
|
8172
|
+
});
|
|
8323
8173
|
})($ || ($ = {}));
|
|
8324
8174
|
|
|
8325
8175
|
;
|
|
8326
8176
|
"use strict";
|
|
8327
8177
|
var $;
|
|
8328
|
-
(function ($) {
|
|
8178
|
+
(function ($_1) {
|
|
8329
8179
|
$mol_test({
|
|
8330
|
-
'
|
|
8331
|
-
$
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
$
|
|
8335
|
-
},
|
|
8336
|
-
'two must be equal'() {
|
|
8337
|
-
$mol_assert_equal(2, 2);
|
|
8338
|
-
},
|
|
8339
|
-
'three must be equal'() {
|
|
8340
|
-
$mol_assert_equal(2, 2, 2);
|
|
8341
|
-
},
|
|
8342
|
-
'two must be unique'() {
|
|
8343
|
-
$mol_assert_unique([2], [3]);
|
|
8344
|
-
},
|
|
8345
|
-
'three must be unique'() {
|
|
8346
|
-
$mol_assert_unique([1], [2], [3]);
|
|
8347
|
-
},
|
|
8348
|
-
'two must be alike'() {
|
|
8349
|
-
$mol_assert_equal([3], [3]);
|
|
8180
|
+
'FQN of anon function'($) {
|
|
8181
|
+
const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
|
|
8182
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '');
|
|
8183
|
+
$mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
|
|
8184
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
|
|
8350
8185
|
},
|
|
8351
|
-
|
|
8352
|
-
|
|
8186
|
+
});
|
|
8187
|
+
})($ || ($ = {}));
|
|
8188
|
+
|
|
8189
|
+
;
|
|
8190
|
+
"use strict";
|
|
8191
|
+
var $;
|
|
8192
|
+
(function ($) {
|
|
8193
|
+
$mol_test({
|
|
8194
|
+
'auto name'() {
|
|
8195
|
+
class Invalid extends $mol_error_mix {
|
|
8196
|
+
}
|
|
8197
|
+
const mix = new Invalid('foo');
|
|
8198
|
+
$mol_assert_equal(mix.name, 'Invalid_Error');
|
|
8353
8199
|
},
|
|
8354
|
-
'
|
|
8355
|
-
|
|
8200
|
+
'simpe mix'() {
|
|
8201
|
+
const mix = new $mol_error_mix('foo', {}, new Error('bar'), new Error('lol'));
|
|
8202
|
+
$mol_assert_equal(mix.message, 'foo');
|
|
8203
|
+
$mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
|
|
8356
8204
|
},
|
|
8357
|
-
'
|
|
8358
|
-
|
|
8205
|
+
'provide additional info'() {
|
|
8206
|
+
class Invalid extends $mol_error_mix {
|
|
8207
|
+
}
|
|
8208
|
+
const mix = new $mol_error_mix('Wrong password', {}, new Invalid('Too short', { value: 'p@ssw0rd', hint: '> 8 letters' }), new Invalid('Too simple', { value: 'p@ssw0rd', hint: 'need capital letter' }));
|
|
8209
|
+
const hints = [];
|
|
8210
|
+
if (mix instanceof $mol_error_mix) {
|
|
8211
|
+
for (const er of mix.errors) {
|
|
8212
|
+
if (er instanceof Invalid) {
|
|
8213
|
+
hints.push(er.cause?.hint ?? '');
|
|
8214
|
+
}
|
|
8215
|
+
}
|
|
8216
|
+
}
|
|
8217
|
+
$mol_assert_equal(hints, ['> 8 letters', 'need capital letter']);
|
|
8359
8218
|
},
|
|
8360
8219
|
});
|
|
8361
8220
|
})($ || ($ = {}));
|
|
@@ -8364,81 +8223,82 @@ var $;
|
|
|
8364
8223
|
"use strict";
|
|
8365
8224
|
var $;
|
|
8366
8225
|
(function ($_1) {
|
|
8367
|
-
$
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8226
|
+
$mol_test({
|
|
8227
|
+
'init with overload'() {
|
|
8228
|
+
class X extends $mol_object {
|
|
8229
|
+
foo() {
|
|
8230
|
+
return 1;
|
|
8231
|
+
}
|
|
8232
|
+
}
|
|
8233
|
+
var x = X.make({
|
|
8234
|
+
foo: () => 2,
|
|
8235
|
+
});
|
|
8236
|
+
$mol_assert_equal(x.foo(), 2);
|
|
8237
|
+
},
|
|
8238
|
+
'Context in instance inherits from class'($) {
|
|
8239
|
+
const custom = $.$mol_ambient({});
|
|
8240
|
+
class X extends $.$mol_object {
|
|
8241
|
+
static $ = custom;
|
|
8242
|
+
}
|
|
8243
|
+
$mol_assert_equal(new X().$, custom);
|
|
8244
|
+
},
|
|
8374
8245
|
});
|
|
8375
8246
|
})($ || ($ = {}));
|
|
8376
8247
|
|
|
8377
|
-
;
|
|
8378
|
-
"use strict";
|
|
8379
|
-
|
|
8380
|
-
;
|
|
8381
|
-
"use strict";
|
|
8382
|
-
|
|
8383
8248
|
;
|
|
8384
8249
|
"use strict";
|
|
8385
8250
|
var $;
|
|
8386
|
-
(function ($) {
|
|
8251
|
+
(function ($_1) {
|
|
8387
8252
|
$mol_test({
|
|
8388
|
-
'
|
|
8389
|
-
const
|
|
8390
|
-
$
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
const target = { foo: 777 };
|
|
8398
|
-
const proxy = $mol_delegate({}, () => target);
|
|
8399
|
-
proxy.foo = 123;
|
|
8400
|
-
$mol_assert_equal(target.foo, 123);
|
|
8401
|
-
},
|
|
8402
|
-
'getOwnPropertyDescriptor'() {
|
|
8403
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
8404
|
-
$mol_assert_like(Object.getOwnPropertyDescriptor(proxy, 'foo'), {
|
|
8405
|
-
value: 777,
|
|
8406
|
-
writable: true,
|
|
8407
|
-
enumerable: true,
|
|
8408
|
-
configurable: true,
|
|
8409
|
-
});
|
|
8410
|
-
},
|
|
8411
|
-
'ownKeys'() {
|
|
8412
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777, [Symbol.toStringTag]: 'bar' }));
|
|
8413
|
-
$mol_assert_like(Reflect.ownKeys(proxy), ['foo', Symbol.toStringTag]);
|
|
8414
|
-
},
|
|
8415
|
-
'getPrototypeOf'() {
|
|
8416
|
-
class Foo {
|
|
8253
|
+
'Collect deps'() {
|
|
8254
|
+
const pub1 = new $mol_wire_pub;
|
|
8255
|
+
const pub2 = new $mol_wire_pub;
|
|
8256
|
+
const sub = new $mol_wire_pub_sub;
|
|
8257
|
+
const bu1 = sub.track_on();
|
|
8258
|
+
try {
|
|
8259
|
+
pub1.promote();
|
|
8260
|
+
pub2.promote();
|
|
8261
|
+
pub2.promote();
|
|
8417
8262
|
}
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
'setPrototypeOf'() {
|
|
8422
|
-
class Foo {
|
|
8263
|
+
finally {
|
|
8264
|
+
sub.track_cut();
|
|
8265
|
+
sub.track_off(bu1);
|
|
8423
8266
|
}
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8267
|
+
pub1.emit();
|
|
8268
|
+
pub2.emit();
|
|
8269
|
+
$mol_assert_like(sub.pub_list, [pub1, pub2, pub2]);
|
|
8270
|
+
const bu2 = sub.track_on();
|
|
8271
|
+
try {
|
|
8272
|
+
pub1.promote();
|
|
8273
|
+
pub1.promote();
|
|
8274
|
+
pub2.promote();
|
|
8431
8275
|
}
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8276
|
+
finally {
|
|
8277
|
+
sub.track_cut();
|
|
8278
|
+
sub.track_off(bu2);
|
|
8279
|
+
}
|
|
8280
|
+
pub1.emit();
|
|
8281
|
+
pub2.emit();
|
|
8282
|
+
$mol_assert_like(sub.pub_list, [pub1, pub1, pub2]);
|
|
8435
8283
|
},
|
|
8436
|
-
'
|
|
8437
|
-
|
|
8284
|
+
'cyclic detection'($) {
|
|
8285
|
+
const sub1 = new $mol_wire_pub_sub;
|
|
8286
|
+
const sub2 = new $mol_wire_pub_sub;
|
|
8287
|
+
const bu1 = sub1.track_on();
|
|
8288
|
+
try {
|
|
8289
|
+
const bu2 = sub2.track_on();
|
|
8290
|
+
try {
|
|
8291
|
+
$mol_assert_fail(() => sub1.promote(), 'Circular subscription');
|
|
8292
|
+
}
|
|
8293
|
+
finally {
|
|
8294
|
+
sub2.track_cut();
|
|
8295
|
+
sub2.track_off(bu2);
|
|
8296
|
+
}
|
|
8297
|
+
}
|
|
8298
|
+
finally {
|
|
8299
|
+
sub1.track_cut();
|
|
8300
|
+
sub1.track_off(bu1);
|
|
8438
8301
|
}
|
|
8439
|
-
const proxy = $mol_delegate({}, () => new Foo);
|
|
8440
|
-
$mol_assert_ok(proxy instanceof Foo);
|
|
8441
|
-
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
8442
8302
|
},
|
|
8443
8303
|
});
|
|
8444
8304
|
})($ || ($ = {}));
|
|
@@ -8446,52 +8306,47 @@ var $;
|
|
|
8446
8306
|
;
|
|
8447
8307
|
"use strict";
|
|
8448
8308
|
var $;
|
|
8449
|
-
(function ($
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
},
|
|
8467
|
-
'slice span - regular'($) {
|
|
8468
|
-
const span = new $mol_span('test.ts', '', 1, 3, 5);
|
|
8469
|
-
const child = span.slice(1, 4);
|
|
8470
|
-
$mol_assert_equal(child.row, 1);
|
|
8471
|
-
$mol_assert_equal(child.col, 4);
|
|
8472
|
-
$mol_assert_equal(child.length, 3);
|
|
8473
|
-
const child2 = span.slice(2, 2);
|
|
8474
|
-
$mol_assert_equal(child2.col, 5);
|
|
8475
|
-
$mol_assert_equal(child2.length, 0);
|
|
8476
|
-
},
|
|
8477
|
-
'slice span - negative'($) {
|
|
8478
|
-
const span = new $mol_span('test.ts', '', 1, 3, 5);
|
|
8479
|
-
const child = span.slice(-3, -1);
|
|
8480
|
-
$mol_assert_equal(child.row, 1);
|
|
8481
|
-
$mol_assert_equal(child.col, 5);
|
|
8482
|
-
$mol_assert_equal(child.length, 2);
|
|
8483
|
-
},
|
|
8484
|
-
'slice span - out of range'($) {
|
|
8485
|
-
const span = new $mol_span('test.ts', '', 1, 3, 5);
|
|
8486
|
-
$mol_assert_fail(() => span.slice(-1, 3), `End value '3' can't be less than begin value (test.ts#1:3/5)`);
|
|
8487
|
-
$mol_assert_fail(() => span.slice(1, 6), `End value '6' out of range (test.ts#1:3/5)`);
|
|
8488
|
-
$mol_assert_fail(() => span.slice(1, 10), `End value '10' out of range (test.ts#1:3/5)`);
|
|
8489
|
-
},
|
|
8490
|
-
'error handling'($) {
|
|
8491
|
-
const span = new $mol_span('test.ts', '', 1, 3, 4);
|
|
8492
|
-
const error = span.error('Some error');
|
|
8493
|
-
$mol_assert_equal(error.message, 'Some error (test.ts#1:3/4)');
|
|
8309
|
+
(function ($) {
|
|
8310
|
+
$.$mol_after_mock_queue = [];
|
|
8311
|
+
function $mol_after_mock_warp() {
|
|
8312
|
+
const queue = $.$mol_after_mock_queue.splice(0);
|
|
8313
|
+
for (const task of queue)
|
|
8314
|
+
task();
|
|
8315
|
+
}
|
|
8316
|
+
$.$mol_after_mock_warp = $mol_after_mock_warp;
|
|
8317
|
+
class $mol_after_mock_commmon extends $mol_object2 {
|
|
8318
|
+
task;
|
|
8319
|
+
promise = Promise.resolve();
|
|
8320
|
+
cancelled = false;
|
|
8321
|
+
id;
|
|
8322
|
+
constructor(task) {
|
|
8323
|
+
super();
|
|
8324
|
+
this.task = task;
|
|
8325
|
+
$.$mol_after_mock_queue.push(task);
|
|
8494
8326
|
}
|
|
8327
|
+
destructor() {
|
|
8328
|
+
const index = $.$mol_after_mock_queue.indexOf(this.task);
|
|
8329
|
+
if (index >= 0)
|
|
8330
|
+
$.$mol_after_mock_queue.splice(index, 1);
|
|
8331
|
+
}
|
|
8332
|
+
}
|
|
8333
|
+
$.$mol_after_mock_commmon = $mol_after_mock_commmon;
|
|
8334
|
+
class $mol_after_mock_timeout extends $mol_after_mock_commmon {
|
|
8335
|
+
delay;
|
|
8336
|
+
constructor(delay, task) {
|
|
8337
|
+
super(task);
|
|
8338
|
+
this.delay = delay;
|
|
8339
|
+
}
|
|
8340
|
+
}
|
|
8341
|
+
$.$mol_after_mock_timeout = $mol_after_mock_timeout;
|
|
8342
|
+
})($ || ($ = {}));
|
|
8343
|
+
|
|
8344
|
+
;
|
|
8345
|
+
"use strict";
|
|
8346
|
+
var $;
|
|
8347
|
+
(function ($_1) {
|
|
8348
|
+
$mol_test_mocks.push($ => {
|
|
8349
|
+
$.$mol_after_tick = $mol_after_mock_commmon;
|
|
8495
8350
|
});
|
|
8496
8351
|
})($ || ($ = {}));
|
|
8497
8352
|
|
|
@@ -8500,13 +8355,79 @@ var $;
|
|
|
8500
8355
|
var $;
|
|
8501
8356
|
(function ($) {
|
|
8502
8357
|
$mol_test({
|
|
8503
|
-
'
|
|
8504
|
-
$
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8358
|
+
'Sync execution'() {
|
|
8359
|
+
class Sync extends $mol_object2 {
|
|
8360
|
+
static calc(a, b) {
|
|
8361
|
+
return a + b;
|
|
8362
|
+
}
|
|
8363
|
+
}
|
|
8364
|
+
__decorate([
|
|
8365
|
+
$mol_wire_method
|
|
8366
|
+
], Sync, "calc", null);
|
|
8367
|
+
$mol_assert_equal(Sync.calc(1, 2), 3);
|
|
8368
|
+
},
|
|
8369
|
+
async 'async <=> sync'() {
|
|
8370
|
+
class SyncAsync extends $mol_object2 {
|
|
8371
|
+
static async val(a) {
|
|
8372
|
+
return a;
|
|
8373
|
+
}
|
|
8374
|
+
static sum(a, b) {
|
|
8375
|
+
const syn = $mol_wire_sync(this);
|
|
8376
|
+
return syn.val(a) + syn.val(b);
|
|
8377
|
+
}
|
|
8378
|
+
static async calc(a, b) {
|
|
8379
|
+
return 5 + await $mol_wire_async(this).sum(a, b);
|
|
8380
|
+
}
|
|
8381
|
+
}
|
|
8382
|
+
$mol_assert_equal(await SyncAsync.calc(1, 2), 8);
|
|
8383
|
+
},
|
|
8384
|
+
async 'Idempotence control'() {
|
|
8385
|
+
class Idempotence extends $mol_object2 {
|
|
8386
|
+
static logs_idemp = 0;
|
|
8387
|
+
static logs_unidemp = 0;
|
|
8388
|
+
static log_idemp() {
|
|
8389
|
+
this.logs_idemp += 1;
|
|
8390
|
+
}
|
|
8391
|
+
static log_unidemp() {
|
|
8392
|
+
this.logs_unidemp += 1;
|
|
8393
|
+
}
|
|
8394
|
+
static async val(a) {
|
|
8395
|
+
return a;
|
|
8396
|
+
}
|
|
8397
|
+
static sum(a, b) {
|
|
8398
|
+
this.log_idemp();
|
|
8399
|
+
this.log_unidemp();
|
|
8400
|
+
const syn = $mol_wire_sync(this);
|
|
8401
|
+
return syn.val(a) + syn.val(b);
|
|
8402
|
+
}
|
|
8403
|
+
static async calc(a, b) {
|
|
8404
|
+
return 5 + await $mol_wire_async(this).sum(a, b);
|
|
8405
|
+
}
|
|
8406
|
+
}
|
|
8407
|
+
__decorate([
|
|
8408
|
+
$mol_wire_method
|
|
8409
|
+
], Idempotence, "log_idemp", null);
|
|
8410
|
+
$mol_assert_equal(await Idempotence.calc(1, 2), 8);
|
|
8411
|
+
$mol_assert_equal(Idempotence.logs_idemp, 1);
|
|
8412
|
+
$mol_assert_equal(Idempotence.logs_unidemp, 3);
|
|
8413
|
+
},
|
|
8414
|
+
async 'Error handling'() {
|
|
8415
|
+
class Handle extends $mol_object2 {
|
|
8416
|
+
static async sum(a, b) {
|
|
8417
|
+
$mol_fail(new Error('test error ' + (a + b)));
|
|
8418
|
+
}
|
|
8419
|
+
static check() {
|
|
8420
|
+
try {
|
|
8421
|
+
return $mol_wire_sync(Handle).sum(1, 2);
|
|
8422
|
+
}
|
|
8423
|
+
catch (error) {
|
|
8424
|
+
if ($mol_promise_like(error))
|
|
8425
|
+
$mol_fail_hidden(error);
|
|
8426
|
+
$mol_assert_equal(error.message, 'test error 3');
|
|
8427
|
+
}
|
|
8428
|
+
}
|
|
8429
|
+
}
|
|
8430
|
+
await $mol_wire_async(Handle).check();
|
|
8510
8431
|
},
|
|
8511
8432
|
});
|
|
8512
8433
|
})($ || ($ = {}));
|
|
@@ -8515,89 +8436,51 @@ var $;
|
|
|
8515
8436
|
"use strict";
|
|
8516
8437
|
var $;
|
|
8517
8438
|
(function ($_1) {
|
|
8518
|
-
function check(tree, ideal) {
|
|
8519
|
-
$mol_assert_equal(tree.toString(), $$.$mol_tree2_from_string(ideal).toString());
|
|
8520
|
-
}
|
|
8521
8439
|
$mol_test({
|
|
8522
|
-
'
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
a b c x
|
|
8532
|
-
`);
|
|
8533
|
-
check($.$mol_tree2_from_string(`
|
|
8534
|
-
a b c d
|
|
8535
|
-
`)
|
|
8536
|
-
.insert($mol_tree2.struct('x'), 0, 0, 0), `
|
|
8537
|
-
a b x
|
|
8538
|
-
`);
|
|
8539
|
-
check($.$mol_tree2_from_string(`
|
|
8540
|
-
a b
|
|
8541
|
-
`)
|
|
8542
|
-
.insert($mol_tree2.struct('x'), 0, 0, 0, 0), `
|
|
8543
|
-
a b \\
|
|
8544
|
-
x
|
|
8545
|
-
`);
|
|
8546
|
-
check($.$mol_tree2_from_string(`
|
|
8547
|
-
a b c d
|
|
8548
|
-
`)
|
|
8549
|
-
.insert($mol_tree2.struct('x'), null, null, null), `
|
|
8550
|
-
a b x
|
|
8551
|
-
`);
|
|
8552
|
-
check($.$mol_tree2_from_string(`
|
|
8553
|
-
a b
|
|
8554
|
-
`)
|
|
8555
|
-
.insert($mol_tree2.struct('x'), null, null, null, null), `
|
|
8556
|
-
a b \\
|
|
8557
|
-
x
|
|
8558
|
-
`);
|
|
8559
|
-
},
|
|
8560
|
-
'updating'($) {
|
|
8561
|
-
check($.$mol_tree2_from_string(`
|
|
8562
|
-
a b c d
|
|
8563
|
-
`).update([], 'a', 'b', 'c')[0], `
|
|
8564
|
-
a b
|
|
8565
|
-
`);
|
|
8566
|
-
check($.$mol_tree2_from_string(`
|
|
8567
|
-
a b c d
|
|
8568
|
-
`).update([$mol_tree2.struct('x')])[0], `
|
|
8569
|
-
x
|
|
8570
|
-
`);
|
|
8571
|
-
check($.$mol_tree2_from_string(`
|
|
8572
|
-
a b c d
|
|
8573
|
-
`).update([$mol_tree2.struct('x'), $mol_tree2.struct('y')], 'a', 'b', 'c')[0], `
|
|
8574
|
-
a b
|
|
8575
|
-
x
|
|
8576
|
-
y
|
|
8577
|
-
`);
|
|
8440
|
+
'test types'($) {
|
|
8441
|
+
class A {
|
|
8442
|
+
static a() {
|
|
8443
|
+
return '';
|
|
8444
|
+
}
|
|
8445
|
+
static b() {
|
|
8446
|
+
return $mol_wire_async(this).a();
|
|
8447
|
+
}
|
|
8448
|
+
}
|
|
8578
8449
|
},
|
|
8579
|
-
'
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8450
|
+
async 'Latest method calls wins'($) {
|
|
8451
|
+
class NameLogger extends $mol_object2 {
|
|
8452
|
+
static $ = $;
|
|
8453
|
+
static first = [];
|
|
8454
|
+
static last = [];
|
|
8455
|
+
static send(next) {
|
|
8456
|
+
$mol_wire_sync(this.first).push(next);
|
|
8457
|
+
$$.$mol_wait_timeout(0);
|
|
8458
|
+
this.last.push(next);
|
|
8459
|
+
}
|
|
8460
|
+
}
|
|
8461
|
+
const name = $mol_wire_async(NameLogger).send;
|
|
8462
|
+
name('john');
|
|
8463
|
+
const promise = name('jin');
|
|
8464
|
+
$.$mol_after_mock_warp();
|
|
8465
|
+
await promise;
|
|
8466
|
+
$mol_assert_equal(NameLogger.first, ['john', 'jin']);
|
|
8467
|
+
$mol_assert_equal(NameLogger.last, ['jin']);
|
|
8592
8468
|
},
|
|
8593
|
-
'
|
|
8594
|
-
const
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
.
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8469
|
+
async 'Latest function calls wins'($) {
|
|
8470
|
+
const first = [];
|
|
8471
|
+
const last = [];
|
|
8472
|
+
function send_name(next) {
|
|
8473
|
+
$mol_wire_sync(first).push(next);
|
|
8474
|
+
$$.$mol_wait_timeout(0);
|
|
8475
|
+
last.push(next);
|
|
8476
|
+
}
|
|
8477
|
+
const name = $mol_wire_async(send_name);
|
|
8478
|
+
name('john');
|
|
8479
|
+
const promise = name('jin');
|
|
8480
|
+
$.$mol_after_mock_warp();
|
|
8481
|
+
await promise;
|
|
8482
|
+
$mol_assert_equal(first, ['john', 'jin']);
|
|
8483
|
+
$mol_assert_equal(last, ['jin']);
|
|
8601
8484
|
},
|
|
8602
8485
|
});
|
|
8603
8486
|
})($ || ($ = {}));
|
|
@@ -8607,158 +8490,154 @@ var $;
|
|
|
8607
8490
|
var $;
|
|
8608
8491
|
(function ($_1) {
|
|
8609
8492
|
$mol_test({
|
|
8610
|
-
'
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
},
|
|
8620
|
-
'Too many tabs'($) {
|
|
8621
|
-
const tree = `
|
|
8622
|
-
foo
|
|
8623
|
-
bar
|
|
8624
|
-
`;
|
|
8625
|
-
$mol_assert_fail(() => {
|
|
8626
|
-
$.$mol_tree2_from_string(tree, 'test');
|
|
8627
|
-
}, 'Too many tabs\ntest#3:1/6\n!!!!!!\n\t\t\t\t\t\tbar');
|
|
8628
|
-
},
|
|
8629
|
-
'Too few tabs'($) {
|
|
8630
|
-
const tree = `
|
|
8631
|
-
foo
|
|
8632
|
-
bar
|
|
8633
|
-
`;
|
|
8634
|
-
$mol_assert_fail(() => {
|
|
8635
|
-
$.$mol_tree2_from_string(tree, 'test');
|
|
8636
|
-
}, 'Too few tabs\ntest#3:1/4\n!!!!\n\t\t\t\tbar');
|
|
8637
|
-
},
|
|
8638
|
-
'Wrong nodes separator at start'($) {
|
|
8639
|
-
const tree = `foo\n \tbar\n`;
|
|
8640
|
-
$mol_assert_fail(() => {
|
|
8641
|
-
$.$mol_tree2_from_string(tree, 'test');
|
|
8642
|
-
}, 'Wrong nodes separator\ntest#2:1/2\n!!\n \tbar');
|
|
8643
|
-
},
|
|
8644
|
-
'Wrong nodes separator in the middle'($) {
|
|
8645
|
-
const tree = `foo bar\n`;
|
|
8646
|
-
$mol_assert_fail(() => {
|
|
8647
|
-
$.$mol_tree2_from_string(tree, 'test');
|
|
8648
|
-
}, 'Wrong nodes separator\ntest#1:5/1\n !\nfoo bar');
|
|
8493
|
+
'test types'($) {
|
|
8494
|
+
class A {
|
|
8495
|
+
static a() {
|
|
8496
|
+
return Promise.resolve('');
|
|
8497
|
+
}
|
|
8498
|
+
static b() {
|
|
8499
|
+
return $mol_wire_sync(this).a();
|
|
8500
|
+
}
|
|
8501
|
+
}
|
|
8649
8502
|
},
|
|
8650
|
-
'
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8503
|
+
async 'test method from host'($) {
|
|
8504
|
+
let count = 0;
|
|
8505
|
+
class A {
|
|
8506
|
+
static a() {
|
|
8507
|
+
return $mol_wire_sync(this).b();
|
|
8508
|
+
}
|
|
8509
|
+
static b() { return Promise.resolve(++count); }
|
|
8510
|
+
}
|
|
8511
|
+
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
|
|
8655
8512
|
},
|
|
8656
|
-
'
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
errors.push(error.message);
|
|
8662
|
-
return null;
|
|
8513
|
+
async 'test function'($) {
|
|
8514
|
+
let count = 0;
|
|
8515
|
+
class A {
|
|
8516
|
+
static a() {
|
|
8517
|
+
return $mol_wire_sync(this.b)();
|
|
8663
8518
|
}
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
$
|
|
8667
|
-
'Wrong nodes separator\ntest#1:5/1\n !\nfoo bar',
|
|
8668
|
-
'Unexpected EOF, LF required\ntest#1:9/1\n !\nfoo bar',
|
|
8669
|
-
]);
|
|
8670
|
-
$mol_assert_equal(res.toString(), 'foo bar\n');
|
|
8519
|
+
static b() { return Promise.resolve(++count); }
|
|
8520
|
+
}
|
|
8521
|
+
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
|
|
8671
8522
|
},
|
|
8523
|
+
async 'test construct itself'($) {
|
|
8524
|
+
class A {
|
|
8525
|
+
static instances = [];
|
|
8526
|
+
static a() {
|
|
8527
|
+
const a = new ($mol_wire_sync(A))();
|
|
8528
|
+
this.instances.push(a);
|
|
8529
|
+
$mol_wire_sync(this).b();
|
|
8530
|
+
}
|
|
8531
|
+
static b() { return Promise.resolve(); }
|
|
8532
|
+
}
|
|
8533
|
+
await $mol_wire_async(A).a();
|
|
8534
|
+
$mol_assert_equal(A.instances.length, 2);
|
|
8535
|
+
$mol_assert_equal(A.instances[0] instanceof A, true);
|
|
8536
|
+
$mol_assert_equal(A.instances[0], A.instances[1]);
|
|
8537
|
+
}
|
|
8672
8538
|
});
|
|
8673
8539
|
})($ || ($ = {}));
|
|
8674
8540
|
|
|
8675
8541
|
;
|
|
8676
8542
|
"use strict";
|
|
8677
8543
|
var $;
|
|
8678
|
-
(function ($) {
|
|
8679
|
-
$
|
|
8680
|
-
|
|
8681
|
-
$mol_assert_equal($mol_tree2_from_json([]).toString(), '/\n');
|
|
8682
|
-
$mol_assert_equal($mol_tree2_from_json([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
|
|
8683
|
-
$mol_assert_equal($mol_tree2_from_json([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
|
|
8684
|
-
$mol_assert_equal($mol_tree2_from_json(new Uint16Array([1, 10, 256])).toString(), '\\\x01\x00\n\\\x00\x00\x01\n');
|
|
8685
|
-
$mol_assert_equal($mol_tree2_from_json(['', 'foo', 'bar\nbaz']).toString(), '/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n');
|
|
8686
|
-
$mol_assert_equal($mol_tree2_from_json({ 'foo': false, 'bar\nbaz': 'lol' }).toString(), '*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n');
|
|
8687
|
-
},
|
|
8544
|
+
(function ($_1) {
|
|
8545
|
+
$mol_test_mocks.push($ => {
|
|
8546
|
+
$.$mol_after_timeout = $mol_after_mock_timeout;
|
|
8688
8547
|
});
|
|
8689
8548
|
})($ || ($ = {}));
|
|
8690
8549
|
|
|
8691
8550
|
;
|
|
8692
8551
|
"use strict";
|
|
8693
8552
|
var $;
|
|
8694
|
-
(function ($
|
|
8695
|
-
$
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8553
|
+
(function ($) {
|
|
8554
|
+
class $mol_after_work extends $mol_object2 {
|
|
8555
|
+
delay;
|
|
8556
|
+
task;
|
|
8557
|
+
id;
|
|
8558
|
+
constructor(delay, task) {
|
|
8559
|
+
super();
|
|
8560
|
+
this.delay = delay;
|
|
8561
|
+
this.task = task;
|
|
8562
|
+
this.id = requestIdleCallback(task, { timeout: delay });
|
|
8563
|
+
}
|
|
8564
|
+
destructor() {
|
|
8565
|
+
cancelIdleCallback(this.id);
|
|
8566
|
+
}
|
|
8567
|
+
}
|
|
8568
|
+
$.$mol_after_work = $mol_after_work;
|
|
8569
|
+
if (typeof requestIdleCallback !== 'function') {
|
|
8570
|
+
$.$mol_after_work = $mol_after_timeout;
|
|
8571
|
+
}
|
|
8703
8572
|
})($ || ($ = {}));
|
|
8704
8573
|
|
|
8705
8574
|
;
|
|
8706
8575
|
"use strict";
|
|
8707
8576
|
var $;
|
|
8708
|
-
(function ($) {
|
|
8709
|
-
$
|
|
8710
|
-
|
|
8711
|
-
class Invalid extends $mol_error_mix {
|
|
8712
|
-
}
|
|
8713
|
-
const mix = new Invalid('foo');
|
|
8714
|
-
$mol_assert_equal(mix.name, 'Invalid_Error');
|
|
8715
|
-
},
|
|
8716
|
-
'simpe mix'() {
|
|
8717
|
-
const mix = new $mol_error_mix('foo', {}, new Error('bar'), new Error('lol'));
|
|
8718
|
-
$mol_assert_equal(mix.message, 'foo');
|
|
8719
|
-
$mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
|
|
8720
|
-
},
|
|
8721
|
-
'provide additional info'() {
|
|
8722
|
-
class Invalid extends $mol_error_mix {
|
|
8723
|
-
}
|
|
8724
|
-
const mix = new $mol_error_mix('Wrong password', {}, new Invalid('Too short', { value: 'p@ssw0rd', hint: '> 8 letters' }), new Invalid('Too simple', { value: 'p@ssw0rd', hint: 'need capital letter' }));
|
|
8725
|
-
const hints = [];
|
|
8726
|
-
if (mix instanceof $mol_error_mix) {
|
|
8727
|
-
for (const er of mix.errors) {
|
|
8728
|
-
if (er instanceof Invalid) {
|
|
8729
|
-
hints.push(er.cause?.hint ?? '');
|
|
8730
|
-
}
|
|
8731
|
-
}
|
|
8732
|
-
}
|
|
8733
|
-
$mol_assert_equal(hints, ['> 8 letters', 'need capital letter']);
|
|
8734
|
-
},
|
|
8577
|
+
(function ($_1) {
|
|
8578
|
+
$mol_test_mocks.push($ => {
|
|
8579
|
+
$.$mol_after_work = $mol_after_mock_timeout;
|
|
8735
8580
|
});
|
|
8736
8581
|
})($ || ($ = {}));
|
|
8737
8582
|
|
|
8583
|
+
;
|
|
8584
|
+
"use strict";
|
|
8585
|
+
var $;
|
|
8586
|
+
(function ($) {
|
|
8587
|
+
function $mol_wait_rest_async() {
|
|
8588
|
+
return new Promise(done => {
|
|
8589
|
+
new this.$mol_after_work(16, () => done(null));
|
|
8590
|
+
});
|
|
8591
|
+
}
|
|
8592
|
+
$.$mol_wait_rest_async = $mol_wait_rest_async;
|
|
8593
|
+
function $mol_wait_rest() {
|
|
8594
|
+
return this.$mol_wire_sync(this).$mol_wait_rest_async();
|
|
8595
|
+
}
|
|
8596
|
+
$.$mol_wait_rest = $mol_wait_rest;
|
|
8597
|
+
})($ || ($ = {}));
|
|
8598
|
+
|
|
8738
8599
|
;
|
|
8739
8600
|
"use strict";
|
|
8740
8601
|
var $;
|
|
8741
8602
|
(function ($_1) {
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
}
|
|
8761
|
-
}
|
|
8603
|
+
var $$;
|
|
8604
|
+
(function ($$) {
|
|
8605
|
+
$mol_test_mocks.push($ => {
|
|
8606
|
+
$.$mol_wait_timeout = function $mol_wait_timeout_mock(timeout) { };
|
|
8607
|
+
$.$mol_wait_timeout_async = async function $mol_wait_timeout_async_mock(timeout) { };
|
|
8608
|
+
});
|
|
8609
|
+
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
8610
|
+
})($ || ($ = {}));
|
|
8611
|
+
|
|
8612
|
+
;
|
|
8613
|
+
"use strict";
|
|
8614
|
+
var $;
|
|
8615
|
+
(function ($) {
|
|
8616
|
+
function $mol_wait_timeout_async(timeout) {
|
|
8617
|
+
const promise = new $mol_promise();
|
|
8618
|
+
const task = new this.$mol_after_timeout(timeout, () => promise.done());
|
|
8619
|
+
return Object.assign(promise, {
|
|
8620
|
+
destructor: () => task.destructor()
|
|
8621
|
+
});
|
|
8622
|
+
}
|
|
8623
|
+
$.$mol_wait_timeout_async = $mol_wait_timeout_async;
|
|
8624
|
+
function $mol_wait_timeout(timeout) {
|
|
8625
|
+
return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
|
|
8626
|
+
}
|
|
8627
|
+
$.$mol_wait_timeout = $mol_wait_timeout;
|
|
8628
|
+
})($ || ($ = {}));
|
|
8629
|
+
|
|
8630
|
+
;
|
|
8631
|
+
"use strict";
|
|
8632
|
+
var $;
|
|
8633
|
+
(function ($_1) {
|
|
8634
|
+
var $$;
|
|
8635
|
+
(function ($$) {
|
|
8636
|
+
$mol_test_mocks.push($ => {
|
|
8637
|
+
$.$mol_wait_rest = function $mol_wait_rest_mock() { };
|
|
8638
|
+
$.$mol_wait_rest_async = async function $mol_wait_rest_async_mock() { };
|
|
8639
|
+
});
|
|
8640
|
+
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
8762
8641
|
})($ || ($ = {}));
|
|
8763
8642
|
|
|
8764
8643
|
;
|
|
@@ -8766,104 +8645,67 @@ var $;
|
|
|
8766
8645
|
var $;
|
|
8767
8646
|
(function ($_1) {
|
|
8768
8647
|
$mol_test({
|
|
8769
|
-
'
|
|
8770
|
-
|
|
8771
|
-
const
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
sub.track_off(bu1);
|
|
8648
|
+
async 'exec timeout auto kill child process'($) {
|
|
8649
|
+
let close_mock = () => { };
|
|
8650
|
+
const error_message = 'Run error, timeout';
|
|
8651
|
+
function mol_run_spawn_sync_mock() {
|
|
8652
|
+
return {
|
|
8653
|
+
output: [],
|
|
8654
|
+
stdout: error_message,
|
|
8655
|
+
stderr: '',
|
|
8656
|
+
status: 0,
|
|
8657
|
+
signal: null,
|
|
8658
|
+
pid: 123,
|
|
8659
|
+
};
|
|
8782
8660
|
}
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8661
|
+
function mol_run_spawn_mock() {
|
|
8662
|
+
return {
|
|
8663
|
+
on(name, cb) {
|
|
8664
|
+
if (name === 'exit')
|
|
8665
|
+
close_mock = cb;
|
|
8666
|
+
},
|
|
8667
|
+
kill() { close_mock(); }
|
|
8668
|
+
};
|
|
8791
8669
|
}
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8670
|
+
const context_mock = $.$mol_ambient({
|
|
8671
|
+
$mol_run_spawn_sync: mol_run_spawn_sync_mock,
|
|
8672
|
+
$mol_run_spawn: mol_run_spawn_mock
|
|
8673
|
+
});
|
|
8674
|
+
class $mol_run_mock extends $mol_run {
|
|
8675
|
+
static get $() { return context_mock; }
|
|
8676
|
+
static async_enabled() {
|
|
8677
|
+
return true;
|
|
8678
|
+
}
|
|
8795
8679
|
}
|
|
8796
|
-
|
|
8797
|
-
pub2.emit();
|
|
8798
|
-
$mol_assert_like(sub.pub_list, [pub1, pub1, pub2]);
|
|
8799
|
-
},
|
|
8800
|
-
'cyclic detection'($) {
|
|
8801
|
-
const sub1 = new $mol_wire_pub_sub;
|
|
8802
|
-
const sub2 = new $mol_wire_pub_sub;
|
|
8803
|
-
const bu1 = sub1.track_on();
|
|
8680
|
+
let message = '';
|
|
8804
8681
|
try {
|
|
8805
|
-
const
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
sub2.track_off(bu2);
|
|
8812
|
-
}
|
|
8682
|
+
const res = await $mol_wire_async($mol_run_mock).spawn({
|
|
8683
|
+
command: 'sleep 10',
|
|
8684
|
+
dir: '.',
|
|
8685
|
+
timeout: 10,
|
|
8686
|
+
env: { 'MOL_RUN_ASYNC': '1' }
|
|
8687
|
+
});
|
|
8813
8688
|
}
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
sub1.track_off(bu1);
|
|
8689
|
+
catch (e) {
|
|
8690
|
+
message = e.message;
|
|
8817
8691
|
}
|
|
8818
|
-
|
|
8692
|
+
$mol_assert_equal(message, error_message);
|
|
8693
|
+
}
|
|
8819
8694
|
});
|
|
8820
8695
|
})($ || ($ = {}));
|
|
8821
8696
|
|
|
8822
8697
|
;
|
|
8823
8698
|
"use strict";
|
|
8824
|
-
var $;
|
|
8825
|
-
(function ($) {
|
|
8826
|
-
$.$mol_after_mock_queue = [];
|
|
8827
|
-
function $mol_after_mock_warp() {
|
|
8828
|
-
const queue = $.$mol_after_mock_queue.splice(0);
|
|
8829
|
-
for (const task of queue)
|
|
8830
|
-
task();
|
|
8831
|
-
}
|
|
8832
|
-
$.$mol_after_mock_warp = $mol_after_mock_warp;
|
|
8833
|
-
class $mol_after_mock_commmon extends $mol_object2 {
|
|
8834
|
-
task;
|
|
8835
|
-
promise = Promise.resolve();
|
|
8836
|
-
cancelled = false;
|
|
8837
|
-
id;
|
|
8838
|
-
constructor(task) {
|
|
8839
|
-
super();
|
|
8840
|
-
this.task = task;
|
|
8841
|
-
$.$mol_after_mock_queue.push(task);
|
|
8842
|
-
}
|
|
8843
|
-
destructor() {
|
|
8844
|
-
const index = $.$mol_after_mock_queue.indexOf(this.task);
|
|
8845
|
-
if (index >= 0)
|
|
8846
|
-
$.$mol_after_mock_queue.splice(index, 1);
|
|
8847
|
-
}
|
|
8848
|
-
}
|
|
8849
|
-
$.$mol_after_mock_commmon = $mol_after_mock_commmon;
|
|
8850
|
-
class $mol_after_mock_timeout extends $mol_after_mock_commmon {
|
|
8851
|
-
delay;
|
|
8852
|
-
constructor(delay, task) {
|
|
8853
|
-
super(task);
|
|
8854
|
-
this.delay = delay;
|
|
8855
|
-
}
|
|
8856
|
-
}
|
|
8857
|
-
$.$mol_after_mock_timeout = $mol_after_mock_timeout;
|
|
8858
|
-
})($ || ($ = {}));
|
|
8859
8699
|
|
|
8860
8700
|
;
|
|
8861
8701
|
"use strict";
|
|
8862
8702
|
var $;
|
|
8863
|
-
(function ($
|
|
8864
|
-
$
|
|
8865
|
-
|
|
8866
|
-
|
|
8703
|
+
(function ($) {
|
|
8704
|
+
function $mol_dom_serialize(node) {
|
|
8705
|
+
const serializer = new $mol_dom_context.XMLSerializer;
|
|
8706
|
+
return serializer.serializeToString(node);
|
|
8707
|
+
}
|
|
8708
|
+
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
8867
8709
|
})($ || ($ = {}));
|
|
8868
8710
|
|
|
8869
8711
|
;
|
|
@@ -8871,195 +8713,101 @@ var $;
|
|
|
8871
8713
|
var $;
|
|
8872
8714
|
(function ($) {
|
|
8873
8715
|
$mol_test({
|
|
8874
|
-
'
|
|
8875
|
-
|
|
8876
|
-
static calc(a, b) {
|
|
8877
|
-
return a + b;
|
|
8878
|
-
}
|
|
8879
|
-
}
|
|
8880
|
-
__decorate([
|
|
8881
|
-
$mol_wire_method
|
|
8882
|
-
], Sync, "calc", null);
|
|
8883
|
-
$mol_assert_equal(Sync.calc(1, 2), 3);
|
|
8716
|
+
'Make empty div'() {
|
|
8717
|
+
$mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
|
|
8884
8718
|
},
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
}
|
|
8890
|
-
static sum(a, b) {
|
|
8891
|
-
const syn = $mol_wire_sync(this);
|
|
8892
|
-
return syn.val(a) + syn.val(b);
|
|
8893
|
-
}
|
|
8894
|
-
static async calc(a, b) {
|
|
8895
|
-
return 5 + await $mol_wire_async(this).sum(a, b);
|
|
8896
|
-
}
|
|
8897
|
-
}
|
|
8898
|
-
$mol_assert_equal(await SyncAsync.calc(1, 2), 8);
|
|
8719
|
+
'Define native field'() {
|
|
8720
|
+
const dom = $mol_jsx("input", { value: '123' });
|
|
8721
|
+
$mol_assert_equal(dom.outerHTML, '<input value="123">');
|
|
8722
|
+
$mol_assert_equal(dom.value, '123');
|
|
8899
8723
|
},
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
static logs_unidemp = 0;
|
|
8904
|
-
static log_idemp() {
|
|
8905
|
-
this.logs_idemp += 1;
|
|
8906
|
-
}
|
|
8907
|
-
static log_unidemp() {
|
|
8908
|
-
this.logs_unidemp += 1;
|
|
8909
|
-
}
|
|
8910
|
-
static async val(a) {
|
|
8911
|
-
return a;
|
|
8912
|
-
}
|
|
8913
|
-
static sum(a, b) {
|
|
8914
|
-
this.log_idemp();
|
|
8915
|
-
this.log_unidemp();
|
|
8916
|
-
const syn = $mol_wire_sync(this);
|
|
8917
|
-
return syn.val(a) + syn.val(b);
|
|
8918
|
-
}
|
|
8919
|
-
static async calc(a, b) {
|
|
8920
|
-
return 5 + await $mol_wire_async(this).sum(a, b);
|
|
8921
|
-
}
|
|
8922
|
-
}
|
|
8923
|
-
__decorate([
|
|
8924
|
-
$mol_wire_method
|
|
8925
|
-
], Idempotence, "log_idemp", null);
|
|
8926
|
-
$mol_assert_equal(await Idempotence.calc(1, 2), 8);
|
|
8927
|
-
$mol_assert_equal(Idempotence.logs_idemp, 1);
|
|
8928
|
-
$mol_assert_equal(Idempotence.logs_unidemp, 3);
|
|
8724
|
+
'Define classes'() {
|
|
8725
|
+
const dom = $mol_jsx("div", { class: 'foo bar' });
|
|
8726
|
+
$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
8929
8727
|
},
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
$mol_fail(new Error('test error ' + (a + b)));
|
|
8934
|
-
}
|
|
8935
|
-
static check() {
|
|
8936
|
-
try {
|
|
8937
|
-
return $mol_wire_sync(Handle).sum(1, 2);
|
|
8938
|
-
}
|
|
8939
|
-
catch (error) {
|
|
8940
|
-
if ($mol_promise_like(error))
|
|
8941
|
-
$mol_fail_hidden(error);
|
|
8942
|
-
$mol_assert_equal(error.message, 'test error 3');
|
|
8943
|
-
}
|
|
8944
|
-
}
|
|
8945
|
-
}
|
|
8946
|
-
await $mol_wire_async(Handle).check();
|
|
8728
|
+
'Define styles'() {
|
|
8729
|
+
const dom = $mol_jsx("div", { style: { color: 'red' } });
|
|
8730
|
+
$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
8947
8731
|
},
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
;
|
|
8952
|
-
"use strict";
|
|
8953
|
-
var $;
|
|
8954
|
-
(function ($_1) {
|
|
8955
|
-
$mol_test({
|
|
8956
|
-
'test types'($) {
|
|
8957
|
-
class A {
|
|
8958
|
-
static a() {
|
|
8959
|
-
return '';
|
|
8960
|
-
}
|
|
8961
|
-
static b() {
|
|
8962
|
-
return $mol_wire_async(this).a();
|
|
8963
|
-
}
|
|
8964
|
-
}
|
|
8732
|
+
'Define dataset'() {
|
|
8733
|
+
const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
|
|
8734
|
+
$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
8965
8735
|
},
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
static first = [];
|
|
8970
|
-
static last = [];
|
|
8971
|
-
static send(next) {
|
|
8972
|
-
$mol_wire_sync(this.first).push(next);
|
|
8973
|
-
$$.$mol_wait_timeout(0);
|
|
8974
|
-
this.last.push(next);
|
|
8975
|
-
}
|
|
8976
|
-
}
|
|
8977
|
-
const name = $mol_wire_async(NameLogger).send;
|
|
8978
|
-
name('john');
|
|
8979
|
-
const promise = name('jin');
|
|
8980
|
-
$.$mol_after_mock_warp();
|
|
8981
|
-
await promise;
|
|
8982
|
-
$mol_assert_equal(NameLogger.first, ['john', 'jin']);
|
|
8983
|
-
$mol_assert_equal(NameLogger.last, ['jin']);
|
|
8736
|
+
'Define attributes'() {
|
|
8737
|
+
const dom = $mol_jsx("div", { lang: "ru", hidden: true });
|
|
8738
|
+
$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
8984
8739
|
},
|
|
8985
|
-
|
|
8986
|
-
const
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
last.push(next);
|
|
8992
|
-
}
|
|
8993
|
-
const name = $mol_wire_async(send_name);
|
|
8994
|
-
name('john');
|
|
8995
|
-
const promise = name('jin');
|
|
8996
|
-
$.$mol_after_mock_warp();
|
|
8997
|
-
await promise;
|
|
8998
|
-
$mol_assert_equal(first, ['john', 'jin']);
|
|
8999
|
-
$mol_assert_equal(last, ['jin']);
|
|
8740
|
+
'Define child nodes'() {
|
|
8741
|
+
const dom = $mol_jsx("div", null,
|
|
8742
|
+
"hello",
|
|
8743
|
+
$mol_jsx("strong", null, "world"),
|
|
8744
|
+
"!");
|
|
8745
|
+
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
9000
8746
|
},
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
;
|
|
9005
|
-
"
|
|
9006
|
-
var $;
|
|
9007
|
-
(function ($_1) {
|
|
9008
|
-
$mol_test({
|
|
9009
|
-
'test types'($) {
|
|
9010
|
-
class A {
|
|
9011
|
-
static a() {
|
|
9012
|
-
return Promise.resolve('');
|
|
9013
|
-
}
|
|
9014
|
-
static b() {
|
|
9015
|
-
return $mol_wire_sync(this).a();
|
|
9016
|
-
}
|
|
9017
|
-
}
|
|
8747
|
+
'Make fragment'() {
|
|
8748
|
+
const dom = $mol_jsx($mol_jsx_frag, null,
|
|
8749
|
+
$mol_jsx("br", null),
|
|
8750
|
+
$mol_jsx("hr", null));
|
|
8751
|
+
$mol_assert_equal($mol_dom_serialize(dom), '<br xmlns="http://www.w3.org/1999/xhtml" /><hr xmlns="http://www.w3.org/1999/xhtml" />');
|
|
9018
8752
|
},
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
static b() { return Promise.resolve(++count); }
|
|
9026
|
-
}
|
|
9027
|
-
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
|
|
8753
|
+
'Spread fragment'() {
|
|
8754
|
+
const dom = $mol_jsx("div", null,
|
|
8755
|
+
$mol_jsx($mol_jsx_frag, null,
|
|
8756
|
+
$mol_jsx("br", null),
|
|
8757
|
+
$mol_jsx("hr", null)));
|
|
8758
|
+
$mol_assert_equal(dom.outerHTML, '<div><br><hr></div>');
|
|
9028
8759
|
},
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
8760
|
+
'Function as component'() {
|
|
8761
|
+
const Button = (props, target) => {
|
|
8762
|
+
return $mol_jsx("button", { title: props.hint }, target());
|
|
8763
|
+
};
|
|
8764
|
+
const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
|
|
8765
|
+
$mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
|
|
8766
|
+
},
|
|
8767
|
+
'Nested guid generation'() {
|
|
8768
|
+
const Foo = () => {
|
|
8769
|
+
return $mol_jsx("div", null,
|
|
8770
|
+
$mol_jsx(Bar, { id: "bar" },
|
|
8771
|
+
$mol_jsx("img", { id: "icon" })));
|
|
8772
|
+
};
|
|
8773
|
+
const Bar = (props, icon) => {
|
|
8774
|
+
return $mol_jsx("span", null,
|
|
8775
|
+
icon,
|
|
8776
|
+
$mol_jsx("i", { id: "label" }));
|
|
8777
|
+
};
|
|
8778
|
+
const dom = $mol_jsx(Foo, { id: "foo" });
|
|
8779
|
+
$mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></span></div>');
|
|
8780
|
+
},
|
|
8781
|
+
'Fail on non unique ids'() {
|
|
8782
|
+
const App = () => {
|
|
8783
|
+
return $mol_jsx("div", null,
|
|
8784
|
+
$mol_jsx("span", { id: "bar" }),
|
|
8785
|
+
$mol_jsx("span", { id: "bar" }));
|
|
8786
|
+
};
|
|
8787
|
+
$mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
|
|
8788
|
+
},
|
|
8789
|
+
'Owner based guid generationn'() {
|
|
8790
|
+
const Foo = () => {
|
|
8791
|
+
return $mol_jsx("div", null,
|
|
8792
|
+
$mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
8793
|
+
};
|
|
8794
|
+
const Bar = (props) => {
|
|
8795
|
+
return $mol_jsx("span", null, props.icon());
|
|
8796
|
+
};
|
|
8797
|
+
const dom = $mol_jsx(Foo, { id: "app" });
|
|
8798
|
+
$mol_assert_equal(dom.outerHTML, '<div id="app" class="Foo"><span id="app/middle" class="Foo_middle Bar"><img id="app/icon" class="Foo_icon"></span></div>');
|
|
8799
|
+
},
|
|
8800
|
+
'Fail on same ids from different caller'() {
|
|
8801
|
+
const Foo = () => {
|
|
8802
|
+
return $mol_jsx("div", null,
|
|
8803
|
+
$mol_jsx("img", { id: "icon" }),
|
|
8804
|
+
$mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
8805
|
+
};
|
|
8806
|
+
const Bar = (props) => {
|
|
8807
|
+
return $mol_jsx("span", null, props.icon());
|
|
8808
|
+
};
|
|
8809
|
+
$mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
|
|
9038
8810
|
},
|
|
9039
|
-
async 'test construct itself'($) {
|
|
9040
|
-
class A {
|
|
9041
|
-
static instances = [];
|
|
9042
|
-
static a() {
|
|
9043
|
-
const a = new ($mol_wire_sync(A))();
|
|
9044
|
-
this.instances.push(a);
|
|
9045
|
-
$mol_wire_sync(this).b();
|
|
9046
|
-
}
|
|
9047
|
-
static b() { return Promise.resolve(); }
|
|
9048
|
-
}
|
|
9049
|
-
await $mol_wire_async(A).a();
|
|
9050
|
-
$mol_assert_equal(A.instances.length, 2);
|
|
9051
|
-
$mol_assert_equal(A.instances[0] instanceof A, true);
|
|
9052
|
-
$mol_assert_equal(A.instances[0], A.instances[1]);
|
|
9053
|
-
}
|
|
9054
|
-
});
|
|
9055
|
-
})($ || ($ = {}));
|
|
9056
|
-
|
|
9057
|
-
;
|
|
9058
|
-
"use strict";
|
|
9059
|
-
var $;
|
|
9060
|
-
(function ($_1) {
|
|
9061
|
-
$mol_test_mocks.push($ => {
|
|
9062
|
-
$.$mol_after_timeout = $mol_after_mock_timeout;
|
|
9063
8811
|
});
|
|
9064
8812
|
})($ || ($ = {}));
|
|
9065
8813
|
|
|
@@ -9067,145 +8815,286 @@ var $;
|
|
|
9067
8815
|
"use strict";
|
|
9068
8816
|
var $;
|
|
9069
8817
|
(function ($) {
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
super();
|
|
9076
|
-
this.delay = delay;
|
|
9077
|
-
this.task = task;
|
|
9078
|
-
this.id = requestIdleCallback(task, { timeout: delay });
|
|
9079
|
-
}
|
|
9080
|
-
destructor() {
|
|
9081
|
-
cancelIdleCallback(this.id);
|
|
8818
|
+
function $mol_range2(item = index => index, size = () => Number.POSITIVE_INFINITY) {
|
|
8819
|
+
const source = typeof item === 'function' ? new $mol_range2_array() : item;
|
|
8820
|
+
if (typeof item !== 'function') {
|
|
8821
|
+
item = index => source[index];
|
|
8822
|
+
size = () => source.length;
|
|
9082
8823
|
}
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
;
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
(
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
}
|
|
9098
|
-
|
|
9099
|
-
;
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
(
|
|
9103
|
-
|
|
9104
|
-
|
|
9105
|
-
|
|
8824
|
+
return new Proxy(source, {
|
|
8825
|
+
get(target, field) {
|
|
8826
|
+
if (typeof field === 'string') {
|
|
8827
|
+
if (field === 'length')
|
|
8828
|
+
return size();
|
|
8829
|
+
const index = Number(field);
|
|
8830
|
+
if (index < 0)
|
|
8831
|
+
return undefined;
|
|
8832
|
+
if (index >= size())
|
|
8833
|
+
return undefined;
|
|
8834
|
+
if (index === Math.trunc(index))
|
|
8835
|
+
return item(index);
|
|
8836
|
+
}
|
|
8837
|
+
return $mol_range2_array.prototype[field];
|
|
8838
|
+
},
|
|
8839
|
+
set(target, field) {
|
|
8840
|
+
return $mol_fail(new TypeError(`Lazy range is read only (trying to set field ${JSON.stringify(field)})`));
|
|
8841
|
+
},
|
|
8842
|
+
ownKeys(target) {
|
|
8843
|
+
return [...Array(size())].map((v, i) => String(i)).concat('length');
|
|
8844
|
+
},
|
|
8845
|
+
getOwnPropertyDescriptor(target, field) {
|
|
8846
|
+
if (field === "length")
|
|
8847
|
+
return {
|
|
8848
|
+
value: size(),
|
|
8849
|
+
writable: true,
|
|
8850
|
+
enumerable: false,
|
|
8851
|
+
configurable: false,
|
|
8852
|
+
};
|
|
8853
|
+
const index = Number(field);
|
|
8854
|
+
if (index === Math.trunc(index))
|
|
8855
|
+
return {
|
|
8856
|
+
get: () => this.get(target, field, this),
|
|
8857
|
+
enumerable: true,
|
|
8858
|
+
configurable: true,
|
|
8859
|
+
};
|
|
8860
|
+
return Object.getOwnPropertyDescriptor(target, field);
|
|
8861
|
+
}
|
|
9106
8862
|
});
|
|
9107
8863
|
}
|
|
9108
|
-
$.$
|
|
9109
|
-
|
|
9110
|
-
|
|
8864
|
+
$.$mol_range2 = $mol_range2;
|
|
8865
|
+
class $mol_range2_array extends Array {
|
|
8866
|
+
concat(...tail) {
|
|
8867
|
+
if (tail.length === 0)
|
|
8868
|
+
return this;
|
|
8869
|
+
if (tail.length > 1) {
|
|
8870
|
+
let list = this;
|
|
8871
|
+
for (let item of tail)
|
|
8872
|
+
list = list.concat(item);
|
|
8873
|
+
return list;
|
|
8874
|
+
}
|
|
8875
|
+
return $mol_range2(index => index < this.length ? this[index] : tail[0][index - this.length], () => this.length + tail[0].length);
|
|
8876
|
+
}
|
|
8877
|
+
filter(check, context) {
|
|
8878
|
+
const filtered = [];
|
|
8879
|
+
let cursor = -1;
|
|
8880
|
+
return $mol_range2(index => {
|
|
8881
|
+
while (cursor < this.length && index >= filtered.length - 1) {
|
|
8882
|
+
const val = this[++cursor];
|
|
8883
|
+
if (check(val, cursor, this))
|
|
8884
|
+
filtered.push(val);
|
|
8885
|
+
}
|
|
8886
|
+
return filtered[index];
|
|
8887
|
+
}, () => cursor < this.length ? Number.POSITIVE_INFINITY : filtered.length);
|
|
8888
|
+
}
|
|
8889
|
+
forEach(proceed, context) {
|
|
8890
|
+
for (let [key, value] of this.entries())
|
|
8891
|
+
proceed.call(context, value, key, this);
|
|
8892
|
+
}
|
|
8893
|
+
map(proceed, context) {
|
|
8894
|
+
return $mol_range2(index => proceed.call(context, this[index], index, this), () => this.length);
|
|
8895
|
+
}
|
|
8896
|
+
reduce(merge, result) {
|
|
8897
|
+
let index = 0;
|
|
8898
|
+
if (arguments.length === 1) {
|
|
8899
|
+
result = this[index++];
|
|
8900
|
+
}
|
|
8901
|
+
for (; index < this.length; ++index) {
|
|
8902
|
+
result = merge(result, this[index], index, this);
|
|
8903
|
+
}
|
|
8904
|
+
return result;
|
|
8905
|
+
}
|
|
8906
|
+
toReversed() {
|
|
8907
|
+
return $mol_range2(index => this[this.length - 1 - index], () => this.length);
|
|
8908
|
+
}
|
|
8909
|
+
slice(from = 0, to = this.length) {
|
|
8910
|
+
return $mol_range2(index => this[from + index], () => Math.min(to, this.length) - from);
|
|
8911
|
+
}
|
|
8912
|
+
some(check, context) {
|
|
8913
|
+
for (let index = 0; index < this.length; ++index) {
|
|
8914
|
+
if (check.call(context, this[index], index, this))
|
|
8915
|
+
return true;
|
|
8916
|
+
}
|
|
8917
|
+
return false;
|
|
8918
|
+
}
|
|
8919
|
+
every(check, context) {
|
|
8920
|
+
for (let index = 0; index < this.length; ++index) {
|
|
8921
|
+
if (!check.call(context, this[index], index, this))
|
|
8922
|
+
return false;
|
|
8923
|
+
}
|
|
8924
|
+
return true;
|
|
8925
|
+
}
|
|
8926
|
+
reverse() {
|
|
8927
|
+
return $mol_fail(new TypeError(`Mutable reverse is forbidden. Use toReversed instead.`));
|
|
8928
|
+
}
|
|
8929
|
+
sort() {
|
|
8930
|
+
return $mol_fail(new TypeError(`Mutable sort is forbidden. Use toSorted instead.`));
|
|
8931
|
+
}
|
|
8932
|
+
indexOf(needle) {
|
|
8933
|
+
return this.findIndex(item => item === needle);
|
|
8934
|
+
}
|
|
8935
|
+
[Symbol.toPrimitive]() {
|
|
8936
|
+
return $mol_guid();
|
|
8937
|
+
}
|
|
9111
8938
|
}
|
|
9112
|
-
$.$
|
|
9113
|
-
})($ || ($ = {}));
|
|
9114
|
-
|
|
9115
|
-
;
|
|
9116
|
-
"use strict";
|
|
9117
|
-
var $;
|
|
9118
|
-
(function ($_1) {
|
|
9119
|
-
var $$;
|
|
9120
|
-
(function ($$) {
|
|
9121
|
-
$mol_test_mocks.push($ => {
|
|
9122
|
-
$.$mol_wait_timeout = function $mol_wait_timeout_mock(timeout) { };
|
|
9123
|
-
$.$mol_wait_timeout_async = async function $mol_wait_timeout_async_mock(timeout) { };
|
|
9124
|
-
});
|
|
9125
|
-
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
8939
|
+
$.$mol_range2_array = $mol_range2_array;
|
|
9126
8940
|
})($ || ($ = {}));
|
|
9127
8941
|
|
|
9128
8942
|
;
|
|
9129
8943
|
"use strict";
|
|
9130
8944
|
var $;
|
|
9131
8945
|
(function ($) {
|
|
9132
|
-
function $mol_wait_timeout_async(timeout) {
|
|
9133
|
-
const promise = new $mol_promise();
|
|
9134
|
-
const task = new this.$mol_after_timeout(timeout, () => promise.done());
|
|
9135
|
-
return Object.assign(promise, {
|
|
9136
|
-
destructor: () => task.destructor()
|
|
9137
|
-
});
|
|
9138
|
-
}
|
|
9139
|
-
$.$mol_wait_timeout_async = $mol_wait_timeout_async;
|
|
9140
|
-
function $mol_wait_timeout(timeout) {
|
|
9141
|
-
return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
|
|
9142
|
-
}
|
|
9143
|
-
$.$mol_wait_timeout = $mol_wait_timeout;
|
|
9144
|
-
})($ || ($ = {}));
|
|
9145
|
-
|
|
9146
|
-
;
|
|
9147
|
-
"use strict";
|
|
9148
|
-
var $;
|
|
9149
|
-
(function ($_1) {
|
|
9150
|
-
var $$;
|
|
9151
|
-
(function ($$) {
|
|
9152
|
-
$mol_test_mocks.push($ => {
|
|
9153
|
-
$.$mol_wait_rest = function $mol_wait_rest_mock() { };
|
|
9154
|
-
$.$mol_wait_rest_async = async function $mol_wait_rest_async_mock() { };
|
|
9155
|
-
});
|
|
9156
|
-
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
9157
|
-
})($ || ($ = {}));
|
|
9158
|
-
|
|
9159
|
-
;
|
|
9160
|
-
"use strict";
|
|
9161
|
-
var $;
|
|
9162
|
-
(function ($_1) {
|
|
9163
8946
|
$mol_test({
|
|
9164
|
-
|
|
9165
|
-
let
|
|
9166
|
-
const
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
}
|
|
9196
|
-
let message = '';
|
|
9197
|
-
try {
|
|
9198
|
-
const res = await $mol_wire_async($mol_run_mock).spawn({
|
|
9199
|
-
command: 'sleep 10',
|
|
9200
|
-
dir: '.',
|
|
9201
|
-
timeout: 10,
|
|
9202
|
-
env: { 'MOL_RUN_ASYNC': '1' }
|
|
9203
|
-
});
|
|
8947
|
+
'lazy calls'() {
|
|
8948
|
+
let calls = 0;
|
|
8949
|
+
const list = $mol_range2(index => (++calls, index), () => 10);
|
|
8950
|
+
$mol_assert_equal(true, list instanceof Array);
|
|
8951
|
+
$mol_assert_equal(list.length, 10);
|
|
8952
|
+
$mol_assert_equal(list[-1], undefined);
|
|
8953
|
+
$mol_assert_equal(list[0], 0);
|
|
8954
|
+
$mol_assert_equal(list[9], 9);
|
|
8955
|
+
$mol_assert_equal(list[9.5], undefined);
|
|
8956
|
+
$mol_assert_equal(list[10], undefined);
|
|
8957
|
+
$mol_assert_equal(calls, 2);
|
|
8958
|
+
},
|
|
8959
|
+
'infinity list'() {
|
|
8960
|
+
let calls = 0;
|
|
8961
|
+
const list = $mol_range2(index => (++calls, index));
|
|
8962
|
+
$mol_assert_equal(list.length, Number.POSITIVE_INFINITY);
|
|
8963
|
+
$mol_assert_equal(list[0], 0);
|
|
8964
|
+
$mol_assert_equal(list[4], 4);
|
|
8965
|
+
$mol_assert_equal(list[Number.MAX_SAFE_INTEGER], Number.MAX_SAFE_INTEGER);
|
|
8966
|
+
$mol_assert_equal(list[Number.POSITIVE_INFINITY], undefined);
|
|
8967
|
+
$mol_assert_equal(calls, 3);
|
|
8968
|
+
},
|
|
8969
|
+
'stringify'() {
|
|
8970
|
+
const list = $mol_range2(i => i, () => 5);
|
|
8971
|
+
$mol_assert_equal(list.toString(), '0,1,2,3,4');
|
|
8972
|
+
$mol_assert_equal(list.join(';'), '0;1;2;3;4');
|
|
8973
|
+
},
|
|
8974
|
+
'for-of'() {
|
|
8975
|
+
let log = '';
|
|
8976
|
+
for (let i of $mol_range2(i => i + 1, () => 5)) {
|
|
8977
|
+
log += i;
|
|
9204
8978
|
}
|
|
9205
|
-
|
|
9206
|
-
|
|
8979
|
+
$mol_assert_equal(log, '12345');
|
|
8980
|
+
},
|
|
8981
|
+
'for-in'() {
|
|
8982
|
+
let log = '';
|
|
8983
|
+
for (let i in $mol_range2(i => i, () => 5)) {
|
|
8984
|
+
log += i;
|
|
9207
8985
|
}
|
|
9208
|
-
$mol_assert_equal(
|
|
8986
|
+
$mol_assert_equal(log, '01234');
|
|
8987
|
+
},
|
|
8988
|
+
'forEach'() {
|
|
8989
|
+
let log = '';
|
|
8990
|
+
$mol_range2(i => i, () => 5).forEach(i => log += i);
|
|
8991
|
+
$mol_assert_equal(log, '01234');
|
|
8992
|
+
},
|
|
8993
|
+
'reduce'() {
|
|
8994
|
+
let calls = 0;
|
|
8995
|
+
const list = $mol_range2().slice(1, 6);
|
|
8996
|
+
$mol_assert_equal(list.reduce((s, v) => s + v), 15);
|
|
8997
|
+
$mol_assert_equal(list.reduce((s, v) => s + v, 5), 20);
|
|
8998
|
+
},
|
|
8999
|
+
'lazy concat'() {
|
|
9000
|
+
let calls1 = 0;
|
|
9001
|
+
let calls2 = 0;
|
|
9002
|
+
const list = $mol_range2(index => (++calls1, index), () => 5).concat([0, 1, 2, 3, 4], $mol_range2(index => (++calls2, index), () => 5));
|
|
9003
|
+
$mol_assert_equal(true, list instanceof Array);
|
|
9004
|
+
$mol_assert_equal(list.length, 15);
|
|
9005
|
+
$mol_assert_equal(list[0], 0);
|
|
9006
|
+
$mol_assert_equal(list[4], 4);
|
|
9007
|
+
$mol_assert_equal(list[5], 0);
|
|
9008
|
+
$mol_assert_equal(list[9], 4);
|
|
9009
|
+
$mol_assert_equal(list[10], 0);
|
|
9010
|
+
$mol_assert_equal(list[14], 4);
|
|
9011
|
+
$mol_assert_equal(list[15], undefined);
|
|
9012
|
+
$mol_assert_equal(calls1, 2);
|
|
9013
|
+
$mol_assert_equal(calls2, 2);
|
|
9014
|
+
},
|
|
9015
|
+
'lazy filter'() {
|
|
9016
|
+
let calls = 0;
|
|
9017
|
+
const list = $mol_range2(index => (++calls, index), () => 15).filter(v => v % 2).slice(0, 3);
|
|
9018
|
+
$mol_assert_equal(true, list instanceof Array);
|
|
9019
|
+
$mol_assert_equal(list.length, 3);
|
|
9020
|
+
$mol_assert_equal(list[0], 1);
|
|
9021
|
+
$mol_assert_equal(list[2], 5);
|
|
9022
|
+
$mol_assert_equal(list[3], undefined);
|
|
9023
|
+
$mol_assert_equal(calls, 8);
|
|
9024
|
+
},
|
|
9025
|
+
'lazy reverse'() {
|
|
9026
|
+
let calls = 0;
|
|
9027
|
+
const list = $mol_range2(index => (++calls, index), () => 10).toReversed().slice(0, 3);
|
|
9028
|
+
$mol_assert_equal(true, list instanceof Array);
|
|
9029
|
+
$mol_assert_equal(list.length, 3);
|
|
9030
|
+
$mol_assert_equal(list[0], 9);
|
|
9031
|
+
$mol_assert_equal(list[2], 7);
|
|
9032
|
+
$mol_assert_equal(list[3], undefined);
|
|
9033
|
+
$mol_assert_equal(calls, 2);
|
|
9034
|
+
},
|
|
9035
|
+
'lazy map'() {
|
|
9036
|
+
let calls1 = 0;
|
|
9037
|
+
let calls2 = 0;
|
|
9038
|
+
const source = $mol_range2(index => (++calls1, index), () => 5);
|
|
9039
|
+
const target = source.map((item, index, self) => {
|
|
9040
|
+
++calls2;
|
|
9041
|
+
$mol_assert_equal(source, self);
|
|
9042
|
+
return index + 10;
|
|
9043
|
+
}, () => 5);
|
|
9044
|
+
$mol_assert_equal(true, target instanceof Array);
|
|
9045
|
+
$mol_assert_equal(target.length, 5);
|
|
9046
|
+
$mol_assert_equal(target[0], 10);
|
|
9047
|
+
$mol_assert_equal(target[4], 14);
|
|
9048
|
+
$mol_assert_equal(target[5], undefined);
|
|
9049
|
+
$mol_assert_equal(calls1, 2);
|
|
9050
|
+
$mol_assert_equal(calls2, 2);
|
|
9051
|
+
},
|
|
9052
|
+
'lazy slice'() {
|
|
9053
|
+
let calls = 0;
|
|
9054
|
+
const list = $mol_range2(index => (++calls, index), () => 10).slice(3, 7);
|
|
9055
|
+
$mol_assert_equal(true, list instanceof Array);
|
|
9056
|
+
$mol_assert_equal(list.length, 4);
|
|
9057
|
+
$mol_assert_equal(list[0], 3);
|
|
9058
|
+
$mol_assert_equal(list[3], 6);
|
|
9059
|
+
$mol_assert_equal(list[4], undefined);
|
|
9060
|
+
$mol_assert_equal(calls, 2);
|
|
9061
|
+
},
|
|
9062
|
+
'lazy some'() {
|
|
9063
|
+
let calls = 0;
|
|
9064
|
+
$mol_assert_equal(true, $mol_range2(index => (++calls, index), () => 5).some(v => v >= 2));
|
|
9065
|
+
$mol_assert_equal(calls, 3);
|
|
9066
|
+
$mol_assert_equal(false, $mol_range2(i => i, () => 0).some(v => true));
|
|
9067
|
+
$mol_assert_equal(true, $mol_range2(i => i).some(v => v > 5));
|
|
9068
|
+
},
|
|
9069
|
+
'lazy every'() {
|
|
9070
|
+
let calls = 0;
|
|
9071
|
+
$mol_assert_equal(false, $mol_range2(index => (++calls, index), () => 5).every(v => v < 2));
|
|
9072
|
+
$mol_assert_equal(calls, 3);
|
|
9073
|
+
$mol_assert_equal(true, $mol_range2(i => i, () => 0).every(v => false));
|
|
9074
|
+
$mol_assert_equal(false, $mol_range2(i => i).every(v => v < 5));
|
|
9075
|
+
},
|
|
9076
|
+
'lazyfy'() {
|
|
9077
|
+
let calls = 0;
|
|
9078
|
+
const list = $mol_range2([0, 1, 2, 3, 4, 5]).map(i => (++calls, i + 10)).slice(2);
|
|
9079
|
+
$mol_assert_equal(true, list instanceof Array);
|
|
9080
|
+
$mol_assert_equal(list.length, 4);
|
|
9081
|
+
$mol_assert_equal(calls, 0);
|
|
9082
|
+
$mol_assert_equal(list[0], 12);
|
|
9083
|
+
$mol_assert_equal(list[3], 15);
|
|
9084
|
+
$mol_assert_equal(list[4], undefined);
|
|
9085
|
+
$mol_assert_equal(calls, 2);
|
|
9086
|
+
},
|
|
9087
|
+
'prevent modification'() {
|
|
9088
|
+
const list = $mol_range2(i => i, () => 5);
|
|
9089
|
+
$mol_assert_fail(() => list.push(4), TypeError);
|
|
9090
|
+
$mol_assert_fail(() => list.pop(), TypeError);
|
|
9091
|
+
$mol_assert_fail(() => list.unshift(4), TypeError);
|
|
9092
|
+
$mol_assert_fail(() => list.shift(), TypeError);
|
|
9093
|
+
$mol_assert_fail(() => list.splice(1, 2), TypeError);
|
|
9094
|
+
$mol_assert_fail(() => list[1] = 2, TypeError);
|
|
9095
|
+
$mol_assert_fail(() => list.reverse(), TypeError);
|
|
9096
|
+
$mol_assert_fail(() => list.sort(), TypeError);
|
|
9097
|
+
$mol_assert_equal(list.toString(), '0,1,2,3,4');
|
|
9209
9098
|
}
|
|
9210
9099
|
});
|
|
9211
9100
|
})($ || ($ = {}));
|
|
@@ -9215,19 +9104,129 @@ var $;
|
|
|
9215
9104
|
var $;
|
|
9216
9105
|
(function ($) {
|
|
9217
9106
|
$mol_test({
|
|
9218
|
-
'
|
|
9219
|
-
$
|
|
9107
|
+
'nulls & undefineds'() {
|
|
9108
|
+
$mol_assert_ok($mol_compare_deep(null, null));
|
|
9109
|
+
$mol_assert_ok($mol_compare_deep(undefined, undefined));
|
|
9110
|
+
$mol_assert_not($mol_compare_deep(undefined, null));
|
|
9111
|
+
$mol_assert_not($mol_compare_deep({}, null));
|
|
9112
|
+
},
|
|
9113
|
+
'number'() {
|
|
9114
|
+
$mol_assert_ok($mol_compare_deep(1, 1));
|
|
9115
|
+
$mol_assert_ok($mol_compare_deep(Number.NaN, Number.NaN));
|
|
9116
|
+
$mol_assert_not($mol_compare_deep(1, 2));
|
|
9117
|
+
$mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
|
|
9118
|
+
$mol_assert_not($mol_compare_deep(Object(1), Object(2)));
|
|
9119
|
+
},
|
|
9120
|
+
'POJO'() {
|
|
9121
|
+
$mol_assert_ok($mol_compare_deep({}, {}));
|
|
9122
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
9123
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
9124
|
+
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
9125
|
+
$mol_assert_not($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
9126
|
+
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
9127
|
+
$mol_assert_ok($mol_compare_deep(Object.create(null), Object.create(null)));
|
|
9128
|
+
},
|
|
9129
|
+
'Array'() {
|
|
9130
|
+
$mol_assert_ok($mol_compare_deep([], []));
|
|
9131
|
+
$mol_assert_ok($mol_compare_deep([1, [2]], [1, [2]]));
|
|
9132
|
+
$mol_assert_not($mol_compare_deep([1, 2], [1, 3]));
|
|
9133
|
+
$mol_assert_not($mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
9134
|
+
$mol_assert_not($mol_compare_deep($mol_range2().slice(0, 0), new Array()));
|
|
9135
|
+
$mol_assert_not($mol_compare_deep($mol_range2(), $mol_range2()));
|
|
9136
|
+
},
|
|
9137
|
+
'Non POJO are different'() {
|
|
9138
|
+
class Thing extends Object {
|
|
9139
|
+
}
|
|
9140
|
+
$mol_assert_not($mol_compare_deep(new Thing, new Thing));
|
|
9141
|
+
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
9142
|
+
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
9143
|
+
},
|
|
9144
|
+
'POJO with symbols'() {
|
|
9145
|
+
const sym = Symbol();
|
|
9146
|
+
$mol_assert_ok($mol_compare_deep({ [sym]: true }, { [sym]: true }));
|
|
9147
|
+
$mol_assert_not($mol_compare_deep({ [Symbol()]: true }, { [Symbol()]: true }));
|
|
9148
|
+
},
|
|
9149
|
+
'same POJOs with cyclic reference'() {
|
|
9150
|
+
const a = { foo: {} };
|
|
9151
|
+
a['self'] = a;
|
|
9152
|
+
const b = { foo: {} };
|
|
9153
|
+
b['self'] = b;
|
|
9154
|
+
$mol_assert_ok($mol_compare_deep(a, b));
|
|
9155
|
+
},
|
|
9156
|
+
'same POJOs with cyclic reference with cache warmup'() {
|
|
9157
|
+
const obj1 = { test: 1, obj3: null };
|
|
9158
|
+
const obj1_copy = { test: 1, obj3: null };
|
|
9159
|
+
const obj2 = { test: 2, obj1 };
|
|
9160
|
+
const obj2_copy = { test: 2, obj1: obj1_copy };
|
|
9161
|
+
const obj3 = { test: 3, obj2 };
|
|
9162
|
+
const obj3_copy = { test: 3, obj2: obj2_copy };
|
|
9163
|
+
obj1.obj3 = obj3;
|
|
9164
|
+
obj1_copy.obj3 = obj3_copy;
|
|
9165
|
+
$mol_assert_not($mol_compare_deep(obj1, {}));
|
|
9166
|
+
$mol_assert_not($mol_compare_deep(obj2, {}));
|
|
9167
|
+
$mol_assert_not($mol_compare_deep(obj3, {}));
|
|
9168
|
+
$mol_assert_ok($mol_compare_deep(obj3, obj3_copy));
|
|
9169
|
+
},
|
|
9170
|
+
'Date'() {
|
|
9171
|
+
$mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
|
|
9172
|
+
$mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));
|
|
9173
|
+
},
|
|
9174
|
+
'RegExp'() {
|
|
9175
|
+
$mol_assert_ok($mol_compare_deep(/\x22/mig, /\x22/mig));
|
|
9176
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x21/mig));
|
|
9177
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x22/mg));
|
|
9178
|
+
},
|
|
9179
|
+
'Error'() {
|
|
9180
|
+
$mol_assert_not($mol_compare_deep(new Error('xxx'), new Error('xxx')));
|
|
9181
|
+
const fail = (message) => new Error(message);
|
|
9182
|
+
$mol_assert_ok($mol_compare_deep(...['xxx', 'xxx'].map(msg => new Error(msg))));
|
|
9183
|
+
$mol_assert_not($mol_compare_deep(...['xxx', 'yyy'].map(msg => new Error(msg))));
|
|
9184
|
+
},
|
|
9185
|
+
'Map'() {
|
|
9186
|
+
$mol_assert_ok($mol_compare_deep(new Map, new Map));
|
|
9187
|
+
$mol_assert_ok($mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
|
|
9188
|
+
$mol_assert_ok($mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
|
|
9189
|
+
$mol_assert_not($mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
|
|
9190
|
+
$mol_assert_not($mol_compare_deep(new Map([[[1], 2]]), new Map([[[3], 2]])));
|
|
9191
|
+
},
|
|
9192
|
+
'Set'() {
|
|
9193
|
+
$mol_assert_ok($mol_compare_deep(new Set, new Set));
|
|
9194
|
+
$mol_assert_ok($mol_compare_deep(new Set([1, [2]]), new Set([1, [2]])));
|
|
9195
|
+
$mol_assert_not($mol_compare_deep(new Set([1]), new Set([2])));
|
|
9196
|
+
},
|
|
9197
|
+
'Uint8Array'() {
|
|
9198
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array, new Uint8Array));
|
|
9199
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
|
|
9200
|
+
$mol_assert_not($mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
|
|
9201
|
+
},
|
|
9202
|
+
'DataView'() {
|
|
9203
|
+
$mol_assert_ok($mol_compare_deep(new DataView(new Uint8Array().buffer), new DataView(new Uint8Array().buffer)));
|
|
9204
|
+
$mol_assert_ok($mol_compare_deep(new DataView(new Uint8Array([0]).buffer), new DataView(new Uint8Array([0]).buffer)));
|
|
9205
|
+
$mol_assert_not($mol_compare_deep(new DataView(new Uint8Array([0]).buffer), new DataView(new Uint8Array([1]).buffer)));
|
|
9206
|
+
},
|
|
9207
|
+
'Serializale'() {
|
|
9208
|
+
class User {
|
|
9209
|
+
name;
|
|
9210
|
+
rand;
|
|
9211
|
+
constructor(name, rand = Math.random()) {
|
|
9212
|
+
this.name = name;
|
|
9213
|
+
this.rand = rand;
|
|
9214
|
+
}
|
|
9215
|
+
[Symbol.toPrimitive](mode) {
|
|
9216
|
+
return this.name;
|
|
9217
|
+
}
|
|
9218
|
+
}
|
|
9219
|
+
$mol_assert_ok($mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
9220
|
+
$mol_assert_not($mol_compare_deep(new User('Jin'), new User('John')));
|
|
9221
|
+
},
|
|
9222
|
+
'Iterable'() {
|
|
9223
|
+
$mol_assert_ok($mol_compare_deep(new URLSearchParams({ foo: 'bar' }), new URLSearchParams({ foo: 'bar' })));
|
|
9224
|
+
$mol_assert_not($mol_compare_deep(new URLSearchParams({ foo: 'xxx' }), new URLSearchParams({ foo: 'yyy' })));
|
|
9225
|
+
$mol_assert_not($mol_compare_deep(new URLSearchParams({ foo: 'xxx', bar: 'yyy' }), new URLSearchParams({ bar: 'yyy', foo: 'xxx' })));
|
|
9220
9226
|
},
|
|
9221
9227
|
});
|
|
9222
9228
|
})($ || ($ = {}));
|
|
9223
9229
|
|
|
9224
|
-
;
|
|
9225
|
-
"use strict";
|
|
9226
|
-
var $;
|
|
9227
|
-
(function ($_1) {
|
|
9228
|
-
$mol_test_mocks.push($ => $.$mol_fail_log = () => false);
|
|
9229
|
-
})($ || ($ = {}));
|
|
9230
|
-
|
|
9231
9230
|
;
|
|
9232
9231
|
"use strict";
|
|
9233
9232
|
|