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