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