mol_regexp 0.0.674 → 0.0.675
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.test.js +209 -209
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.test.js +65 -65
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -321,24 +321,6 @@ var $;
|
|
|
321
321
|
//mol/regexp/regexp.ts
|
|
322
322
|
;
|
|
323
323
|
"use strict";
|
|
324
|
-
//mol/type/error/error.ts
|
|
325
|
-
;
|
|
326
|
-
"use strict";
|
|
327
|
-
//mol/type/assert/assert.ts
|
|
328
|
-
;
|
|
329
|
-
"use strict";
|
|
330
|
-
//mol/type/assert/assert.test.ts
|
|
331
|
-
;
|
|
332
|
-
"use strict";
|
|
333
|
-
//mol/type/equals/equals.test.ts
|
|
334
|
-
;
|
|
335
|
-
"use strict";
|
|
336
|
-
//mol/type/merge/merge.test.ts
|
|
337
|
-
;
|
|
338
|
-
"use strict";
|
|
339
|
-
//mol/type/intersect/intersect.test.ts
|
|
340
|
-
;
|
|
341
|
-
"use strict";
|
|
342
324
|
var $;
|
|
343
325
|
(function ($) {
|
|
344
326
|
function $mol_fail_hidden(error) {
|
|
@@ -712,12 +694,24 @@ var $;
|
|
|
712
694
|
//mol/dom/render/children/children.ts
|
|
713
695
|
;
|
|
714
696
|
"use strict";
|
|
715
|
-
//mol/type/
|
|
697
|
+
//mol/type/error/error.ts
|
|
698
|
+
;
|
|
699
|
+
"use strict";
|
|
700
|
+
//mol/type/assert/assert.test.ts
|
|
701
|
+
;
|
|
702
|
+
"use strict";
|
|
703
|
+
//mol/type/assert/assert.ts
|
|
704
|
+
;
|
|
705
|
+
"use strict";
|
|
706
|
+
//mol/type/equals/equals.test.ts
|
|
716
707
|
;
|
|
717
708
|
"use strict";
|
|
718
709
|
//mol/type/partial/deep/deep.test.ts
|
|
719
710
|
;
|
|
720
711
|
"use strict";
|
|
712
|
+
//mol/type/partial/deep/deep.ts
|
|
713
|
+
;
|
|
714
|
+
"use strict";
|
|
721
715
|
var $;
|
|
722
716
|
(function ($) {
|
|
723
717
|
$mol_test({
|
|
@@ -1162,6 +1156,38 @@ var $;
|
|
|
1162
1156
|
;
|
|
1163
1157
|
"use strict";
|
|
1164
1158
|
var $;
|
|
1159
|
+
(function ($) {
|
|
1160
|
+
$mol_test({
|
|
1161
|
+
'must be false'() {
|
|
1162
|
+
$mol_assert_not(0);
|
|
1163
|
+
},
|
|
1164
|
+
'must be true'() {
|
|
1165
|
+
$mol_assert_ok(1);
|
|
1166
|
+
},
|
|
1167
|
+
'two must be equal'() {
|
|
1168
|
+
$mol_assert_equal(2, 2);
|
|
1169
|
+
},
|
|
1170
|
+
'three must be equal'() {
|
|
1171
|
+
$mol_assert_equal(2, 2, 2);
|
|
1172
|
+
},
|
|
1173
|
+
'two must be unique'() {
|
|
1174
|
+
$mol_assert_unique([3], [3]);
|
|
1175
|
+
},
|
|
1176
|
+
'three must be unique'() {
|
|
1177
|
+
$mol_assert_unique([3], [3], [3]);
|
|
1178
|
+
},
|
|
1179
|
+
'two must be alike'() {
|
|
1180
|
+
$mol_assert_like([3], [3]);
|
|
1181
|
+
},
|
|
1182
|
+
'three must be alike'() {
|
|
1183
|
+
$mol_assert_like([3], [3], [3]);
|
|
1184
|
+
},
|
|
1185
|
+
});
|
|
1186
|
+
})($ || ($ = {}));
|
|
1187
|
+
//mol/assert/assert.test.ts
|
|
1188
|
+
;
|
|
1189
|
+
"use strict";
|
|
1190
|
+
var $;
|
|
1165
1191
|
(function ($) {
|
|
1166
1192
|
function $mol_assert_ok(value) {
|
|
1167
1193
|
if (value)
|
|
@@ -1255,47 +1281,121 @@ var $;
|
|
|
1255
1281
|
//mol/assert/assert.ts
|
|
1256
1282
|
;
|
|
1257
1283
|
"use strict";
|
|
1284
|
+
//mol/type/merge/merge.test.ts
|
|
1285
|
+
;
|
|
1286
|
+
"use strict";
|
|
1287
|
+
//mol/type/intersect/intersect.test.ts
|
|
1288
|
+
;
|
|
1289
|
+
"use strict";
|
|
1290
|
+
var $;
|
|
1291
|
+
(function ($) {
|
|
1292
|
+
$.$mol_ambient_ref = Symbol('$mol_ambient_ref');
|
|
1293
|
+
function $mol_ambient(overrides) {
|
|
1294
|
+
return Object.setPrototypeOf(overrides, this || $);
|
|
1295
|
+
}
|
|
1296
|
+
$.$mol_ambient = $mol_ambient;
|
|
1297
|
+
})($ || ($ = {}));
|
|
1298
|
+
//mol/ambient/ambient.ts
|
|
1299
|
+
;
|
|
1300
|
+
"use strict";
|
|
1258
1301
|
var $;
|
|
1259
1302
|
(function ($) {
|
|
1260
1303
|
$mol_test({
|
|
1261
|
-
'
|
|
1262
|
-
$
|
|
1304
|
+
'get'() {
|
|
1305
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1306
|
+
$mol_assert_equal(proxy.foo, 777);
|
|
1263
1307
|
},
|
|
1264
|
-
'
|
|
1265
|
-
$
|
|
1308
|
+
'has'() {
|
|
1309
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1310
|
+
$mol_assert_equal('foo' in proxy, true);
|
|
1266
1311
|
},
|
|
1267
|
-
'
|
|
1268
|
-
|
|
1312
|
+
'set'() {
|
|
1313
|
+
const target = { foo: 777 };
|
|
1314
|
+
const proxy = $mol_delegate({}, () => target);
|
|
1315
|
+
proxy.foo = 123;
|
|
1316
|
+
$mol_assert_equal(target.foo, 123);
|
|
1269
1317
|
},
|
|
1270
|
-
'
|
|
1271
|
-
$
|
|
1318
|
+
'getOwnPropertyDescriptor'() {
|
|
1319
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1320
|
+
$mol_assert_like(Object.getOwnPropertyDescriptor(proxy, 'foo'), {
|
|
1321
|
+
value: 777,
|
|
1322
|
+
writable: true,
|
|
1323
|
+
enumerable: true,
|
|
1324
|
+
configurable: true,
|
|
1325
|
+
});
|
|
1272
1326
|
},
|
|
1273
|
-
'
|
|
1274
|
-
$
|
|
1327
|
+
'ownKeys'() {
|
|
1328
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777, [Symbol.toStringTag]: 'bar' }));
|
|
1329
|
+
$mol_assert_like(Reflect.ownKeys(proxy), ['foo', Symbol.toStringTag]);
|
|
1275
1330
|
},
|
|
1276
|
-
'
|
|
1277
|
-
|
|
1331
|
+
'getPrototypeOf'() {
|
|
1332
|
+
class Foo {
|
|
1333
|
+
}
|
|
1334
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
1335
|
+
$mol_assert_equal(Object.getPrototypeOf(proxy), Foo.prototype);
|
|
1278
1336
|
},
|
|
1279
|
-
'
|
|
1280
|
-
|
|
1337
|
+
'setPrototypeOf'() {
|
|
1338
|
+
class Foo {
|
|
1339
|
+
}
|
|
1340
|
+
const target = {};
|
|
1341
|
+
const proxy = $mol_delegate({}, () => target);
|
|
1342
|
+
Object.setPrototypeOf(proxy, Foo.prototype);
|
|
1343
|
+
$mol_assert_equal(Object.getPrototypeOf(target), Foo.prototype);
|
|
1281
1344
|
},
|
|
1282
|
-
'
|
|
1283
|
-
|
|
1345
|
+
'instanceof'() {
|
|
1346
|
+
class Foo {
|
|
1347
|
+
}
|
|
1348
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
1349
|
+
$mol_assert_ok(proxy instanceof Foo);
|
|
1350
|
+
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
1351
|
+
},
|
|
1352
|
+
'autobind'() {
|
|
1353
|
+
class Foo {
|
|
1354
|
+
}
|
|
1355
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
1356
|
+
$mol_assert_ok(proxy instanceof Foo);
|
|
1357
|
+
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
1284
1358
|
},
|
|
1285
1359
|
});
|
|
1286
1360
|
})($ || ($ = {}));
|
|
1287
|
-
//mol/
|
|
1361
|
+
//mol/delegate/delegate.test.ts
|
|
1288
1362
|
;
|
|
1289
1363
|
"use strict";
|
|
1290
1364
|
var $;
|
|
1291
1365
|
(function ($) {
|
|
1292
|
-
|
|
1293
|
-
function $
|
|
1294
|
-
|
|
1366
|
+
const instances = new WeakSet();
|
|
1367
|
+
function $mol_delegate(proto, target) {
|
|
1368
|
+
const proxy = new Proxy(proto, {
|
|
1369
|
+
get: (_, field) => {
|
|
1370
|
+
const obj = target();
|
|
1371
|
+
let val = Reflect.get(obj, field);
|
|
1372
|
+
if (typeof val === 'function') {
|
|
1373
|
+
val = val.bind(obj);
|
|
1374
|
+
}
|
|
1375
|
+
return val;
|
|
1376
|
+
},
|
|
1377
|
+
has: (_, field) => Reflect.has(target(), field),
|
|
1378
|
+
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
1379
|
+
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
1380
|
+
ownKeys: () => Reflect.ownKeys(target()),
|
|
1381
|
+
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
1382
|
+
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
1383
|
+
isExtensible: () => Reflect.isExtensible(target()),
|
|
1384
|
+
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
1385
|
+
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
1386
|
+
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
1387
|
+
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
1388
|
+
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
1389
|
+
});
|
|
1390
|
+
instances.add(proxy);
|
|
1391
|
+
return proxy;
|
|
1295
1392
|
}
|
|
1296
|
-
$.$
|
|
1393
|
+
$.$mol_delegate = $mol_delegate;
|
|
1394
|
+
Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
|
|
1395
|
+
value: (obj) => instances.has(obj),
|
|
1396
|
+
});
|
|
1297
1397
|
})($ || ($ = {}));
|
|
1298
|
-
//mol/
|
|
1398
|
+
//mol/delegate/delegate.ts
|
|
1299
1399
|
;
|
|
1300
1400
|
"use strict";
|
|
1301
1401
|
var $;
|
|
@@ -1354,10 +1454,10 @@ var $;
|
|
|
1354
1454
|
//mol/owning/owning.ts
|
|
1355
1455
|
;
|
|
1356
1456
|
"use strict";
|
|
1357
|
-
//mol/type/writable/writable.ts
|
|
1457
|
+
//mol/type/writable/writable.test.ts
|
|
1358
1458
|
;
|
|
1359
1459
|
"use strict";
|
|
1360
|
-
//mol/type/writable/writable.
|
|
1460
|
+
//mol/type/writable/writable.ts
|
|
1361
1461
|
;
|
|
1362
1462
|
"use strict";
|
|
1363
1463
|
var $;
|
|
@@ -1404,6 +1504,66 @@ var $;
|
|
|
1404
1504
|
;
|
|
1405
1505
|
"use strict";
|
|
1406
1506
|
var $;
|
|
1507
|
+
(function ($_1) {
|
|
1508
|
+
$mol_test({
|
|
1509
|
+
'tree parsing'() {
|
|
1510
|
+
$mol_assert_equal($mol_tree.fromString("foo\nbar\n").sub.length, 2);
|
|
1511
|
+
$mol_assert_equal($mol_tree.fromString("foo\nbar\n").sub[1].type, "bar");
|
|
1512
|
+
$mol_assert_equal($mol_tree.fromString("foo\n\n\n").sub.length, 1);
|
|
1513
|
+
$mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub.length, 2);
|
|
1514
|
+
$mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub[1].data, "bar");
|
|
1515
|
+
$mol_assert_equal($mol_tree.fromString("foo bar \\pol").sub[0].sub[0].sub[0].data, "pol");
|
|
1516
|
+
$mol_assert_equal($mol_tree.fromString("foo bar\n\t\\pol\n\t\\men").sub[0].sub[0].sub[1].data, "men");
|
|
1517
|
+
$mol_assert_equal($mol_tree.fromString('foo bar \\text\n').toString(), 'foo bar \\text\n');
|
|
1518
|
+
},
|
|
1519
|
+
'inserting'() {
|
|
1520
|
+
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 'a', 'b', 'c').toString(), 'a b \\\n');
|
|
1521
|
+
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 'a', 'b', 'c', 'd').toString(), 'a b c \\\n');
|
|
1522
|
+
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 0, 0, 0).toString(), 'a b \\\n');
|
|
1523
|
+
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 0, 0, 0, 0).toString(), 'a b \\\n\t\\\n');
|
|
1524
|
+
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, null, null, null).toString(), 'a b \\\n');
|
|
1525
|
+
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, null, null, null, null).toString(), 'a b \\\n\t\\\n');
|
|
1526
|
+
},
|
|
1527
|
+
'fromJSON'() {
|
|
1528
|
+
$mol_assert_equal($mol_tree.fromJSON([]).toString(), '/\n');
|
|
1529
|
+
$mol_assert_equal($mol_tree.fromJSON([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
|
|
1530
|
+
$mol_assert_equal($mol_tree.fromJSON([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
|
|
1531
|
+
$mol_assert_equal($mol_tree.fromJSON(['', 'foo', 'bar\nbaz']).toString(), '/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n');
|
|
1532
|
+
$mol_assert_equal($mol_tree.fromJSON({ 'foo': false, 'bar\nbaz': 'lol' }).toString(), '*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n');
|
|
1533
|
+
},
|
|
1534
|
+
'toJSON'() {
|
|
1535
|
+
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n').sub[0]), '[]');
|
|
1536
|
+
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\tfalse\n\ttrue\n').sub[0]), '[false,true]');
|
|
1537
|
+
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\t0\n\t1\n\t2.3\n').sub[0]), '[0,1,2.3]');
|
|
1538
|
+
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n').sub[0]), '["","foo","bar\\nbaz"]');
|
|
1539
|
+
$mol_assert_equal(JSON.stringify($mol_tree.fromString('*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n').sub[0]), '{"foo":false,"bar\\nbaz":"lol"}');
|
|
1540
|
+
},
|
|
1541
|
+
'hack'() {
|
|
1542
|
+
const res = $mol_tree.fromString(`foo bar xxx`).hack({
|
|
1543
|
+
'': (tree, context) => [tree.hack(context)],
|
|
1544
|
+
'bar': (tree, context) => [tree.hack(context).clone({ type: '777' })],
|
|
1545
|
+
});
|
|
1546
|
+
$mol_assert_equal(res.toString(), new $mol_tree({ type: 'foo 777 xxx' }).toString());
|
|
1547
|
+
},
|
|
1548
|
+
'errors handling'($) {
|
|
1549
|
+
const errors = [];
|
|
1550
|
+
class Tree extends $mol_tree {
|
|
1551
|
+
static $ = $.$mol_ambient({
|
|
1552
|
+
$mol_fail: error => errors.push(error.message)
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
Tree.fromString(`
|
|
1556
|
+
\t \tfoo
|
|
1557
|
+
bar \\data
|
|
1558
|
+
`, 'test');
|
|
1559
|
+
$mol_assert_like(errors, ['Syntax error at test:2\n \tfoo']);
|
|
1560
|
+
},
|
|
1561
|
+
});
|
|
1562
|
+
})($ || ($ = {}));
|
|
1563
|
+
//mol/tree/tree.test.ts
|
|
1564
|
+
;
|
|
1565
|
+
"use strict";
|
|
1566
|
+
var $;
|
|
1407
1567
|
(function ($) {
|
|
1408
1568
|
$.$mol_tree_convert = Symbol('$mol_tree_convert');
|
|
1409
1569
|
class $mol_tree extends $mol_object2 {
|
|
@@ -1734,163 +1894,17 @@ var $;
|
|
|
1734
1894
|
;
|
|
1735
1895
|
"use strict";
|
|
1736
1896
|
var $;
|
|
1737
|
-
(function ($) {
|
|
1738
|
-
const instances = new WeakSet();
|
|
1739
|
-
function $mol_delegate(proto, target) {
|
|
1740
|
-
const proxy = new Proxy(proto, {
|
|
1741
|
-
get: (_, field) => {
|
|
1742
|
-
const obj = target();
|
|
1743
|
-
let val = Reflect.get(obj, field);
|
|
1744
|
-
if (typeof val === 'function') {
|
|
1745
|
-
val = val.bind(obj);
|
|
1746
|
-
}
|
|
1747
|
-
return val;
|
|
1748
|
-
},
|
|
1749
|
-
has: (_, field) => Reflect.has(target(), field),
|
|
1750
|
-
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
1751
|
-
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
1752
|
-
ownKeys: () => Reflect.ownKeys(target()),
|
|
1753
|
-
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
1754
|
-
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
1755
|
-
isExtensible: () => Reflect.isExtensible(target()),
|
|
1756
|
-
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
1757
|
-
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
1758
|
-
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
1759
|
-
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
1760
|
-
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
1761
|
-
});
|
|
1762
|
-
instances.add(proxy);
|
|
1763
|
-
return proxy;
|
|
1764
|
-
}
|
|
1765
|
-
$.$mol_delegate = $mol_delegate;
|
|
1766
|
-
Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
|
|
1767
|
-
value: (obj) => instances.has(obj),
|
|
1768
|
-
});
|
|
1769
|
-
})($ || ($ = {}));
|
|
1770
|
-
//mol/delegate/delegate.ts
|
|
1771
|
-
;
|
|
1772
|
-
"use strict";
|
|
1773
|
-
var $;
|
|
1774
|
-
(function ($) {
|
|
1775
|
-
$mol_test({
|
|
1776
|
-
'get'() {
|
|
1777
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1778
|
-
$mol_assert_equal(proxy.foo, 777);
|
|
1779
|
-
},
|
|
1780
|
-
'has'() {
|
|
1781
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1782
|
-
$mol_assert_equal('foo' in proxy, true);
|
|
1783
|
-
},
|
|
1784
|
-
'set'() {
|
|
1785
|
-
const target = { foo: 777 };
|
|
1786
|
-
const proxy = $mol_delegate({}, () => target);
|
|
1787
|
-
proxy.foo = 123;
|
|
1788
|
-
$mol_assert_equal(target.foo, 123);
|
|
1789
|
-
},
|
|
1790
|
-
'getOwnPropertyDescriptor'() {
|
|
1791
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1792
|
-
$mol_assert_like(Object.getOwnPropertyDescriptor(proxy, 'foo'), {
|
|
1793
|
-
value: 777,
|
|
1794
|
-
writable: true,
|
|
1795
|
-
enumerable: true,
|
|
1796
|
-
configurable: true,
|
|
1797
|
-
});
|
|
1798
|
-
},
|
|
1799
|
-
'ownKeys'() {
|
|
1800
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777, [Symbol.toStringTag]: 'bar' }));
|
|
1801
|
-
$mol_assert_like(Reflect.ownKeys(proxy), ['foo', Symbol.toStringTag]);
|
|
1802
|
-
},
|
|
1803
|
-
'getPrototypeOf'() {
|
|
1804
|
-
class Foo {
|
|
1805
|
-
}
|
|
1806
|
-
const proxy = $mol_delegate({}, () => new Foo);
|
|
1807
|
-
$mol_assert_equal(Object.getPrototypeOf(proxy), Foo.prototype);
|
|
1808
|
-
},
|
|
1809
|
-
'setPrototypeOf'() {
|
|
1810
|
-
class Foo {
|
|
1811
|
-
}
|
|
1812
|
-
const target = {};
|
|
1813
|
-
const proxy = $mol_delegate({}, () => target);
|
|
1814
|
-
Object.setPrototypeOf(proxy, Foo.prototype);
|
|
1815
|
-
$mol_assert_equal(Object.getPrototypeOf(target), Foo.prototype);
|
|
1816
|
-
},
|
|
1817
|
-
'instanceof'() {
|
|
1818
|
-
class Foo {
|
|
1819
|
-
}
|
|
1820
|
-
const proxy = $mol_delegate({}, () => new Foo);
|
|
1821
|
-
$mol_assert_ok(proxy instanceof Foo);
|
|
1822
|
-
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
1823
|
-
},
|
|
1824
|
-
'autobind'() {
|
|
1825
|
-
class Foo {
|
|
1826
|
-
}
|
|
1827
|
-
const proxy = $mol_delegate({}, () => new Foo);
|
|
1828
|
-
$mol_assert_ok(proxy instanceof Foo);
|
|
1829
|
-
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
1830
|
-
},
|
|
1831
|
-
});
|
|
1832
|
-
})($ || ($ = {}));
|
|
1833
|
-
//mol/delegate/delegate.test.ts
|
|
1834
|
-
;
|
|
1835
|
-
"use strict";
|
|
1836
|
-
var $;
|
|
1837
1897
|
(function ($_1) {
|
|
1838
1898
|
$mol_test({
|
|
1839
|
-
'
|
|
1840
|
-
|
|
1841
|
-
$mol_assert_equal(
|
|
1842
|
-
$mol_assert_equal(
|
|
1843
|
-
$mol_assert_equal(
|
|
1844
|
-
$mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub[1].data, "bar");
|
|
1845
|
-
$mol_assert_equal($mol_tree.fromString("foo bar \\pol").sub[0].sub[0].sub[0].data, "pol");
|
|
1846
|
-
$mol_assert_equal($mol_tree.fromString("foo bar\n\t\\pol\n\t\\men").sub[0].sub[0].sub[1].data, "men");
|
|
1847
|
-
$mol_assert_equal($mol_tree.fromString('foo bar \\text\n').toString(), 'foo bar \\text\n');
|
|
1848
|
-
},
|
|
1849
|
-
'inserting'() {
|
|
1850
|
-
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 'a', 'b', 'c').toString(), 'a b \\\n');
|
|
1851
|
-
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 'a', 'b', 'c', 'd').toString(), 'a b c \\\n');
|
|
1852
|
-
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 0, 0, 0).toString(), 'a b \\\n');
|
|
1853
|
-
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 0, 0, 0, 0).toString(), 'a b \\\n\t\\\n');
|
|
1854
|
-
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, null, null, null).toString(), 'a b \\\n');
|
|
1855
|
-
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, null, null, null, null).toString(), 'a b \\\n\t\\\n');
|
|
1856
|
-
},
|
|
1857
|
-
'fromJSON'() {
|
|
1858
|
-
$mol_assert_equal($mol_tree.fromJSON([]).toString(), '/\n');
|
|
1859
|
-
$mol_assert_equal($mol_tree.fromJSON([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
|
|
1860
|
-
$mol_assert_equal($mol_tree.fromJSON([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
|
|
1861
|
-
$mol_assert_equal($mol_tree.fromJSON(['', 'foo', 'bar\nbaz']).toString(), '/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n');
|
|
1862
|
-
$mol_assert_equal($mol_tree.fromJSON({ 'foo': false, 'bar\nbaz': 'lol' }).toString(), '*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n');
|
|
1863
|
-
},
|
|
1864
|
-
'toJSON'() {
|
|
1865
|
-
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n').sub[0]), '[]');
|
|
1866
|
-
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\tfalse\n\ttrue\n').sub[0]), '[false,true]');
|
|
1867
|
-
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\t0\n\t1\n\t2.3\n').sub[0]), '[0,1,2.3]');
|
|
1868
|
-
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n').sub[0]), '["","foo","bar\\nbaz"]');
|
|
1869
|
-
$mol_assert_equal(JSON.stringify($mol_tree.fromString('*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n').sub[0]), '{"foo":false,"bar\\nbaz":"lol"}');
|
|
1870
|
-
},
|
|
1871
|
-
'hack'() {
|
|
1872
|
-
const res = $mol_tree.fromString(`foo bar xxx`).hack({
|
|
1873
|
-
'': (tree, context) => [tree.hack(context)],
|
|
1874
|
-
'bar': (tree, context) => [tree.hack(context).clone({ type: '777' })],
|
|
1875
|
-
});
|
|
1876
|
-
$mol_assert_equal(res.toString(), new $mol_tree({ type: 'foo 777 xxx' }).toString());
|
|
1877
|
-
},
|
|
1878
|
-
'errors handling'($) {
|
|
1879
|
-
const errors = [];
|
|
1880
|
-
class Tree extends $mol_tree {
|
|
1881
|
-
static $ = $.$mol_ambient({
|
|
1882
|
-
$mol_fail: error => errors.push(error.message)
|
|
1883
|
-
});
|
|
1884
|
-
}
|
|
1885
|
-
Tree.fromString(`
|
|
1886
|
-
\t \tfoo
|
|
1887
|
-
bar \\data
|
|
1888
|
-
`, 'test');
|
|
1889
|
-
$mol_assert_like(errors, ['Syntax error at test:2\n \tfoo']);
|
|
1899
|
+
'FQN of anon function'($) {
|
|
1900
|
+
const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
|
|
1901
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '');
|
|
1902
|
+
$mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
|
|
1903
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
|
|
1890
1904
|
},
|
|
1891
1905
|
});
|
|
1892
1906
|
})($ || ($ = {}));
|
|
1893
|
-
//mol/
|
|
1907
|
+
//mol/func/name/name.test.ts
|
|
1894
1908
|
;
|
|
1895
1909
|
"use strict";
|
|
1896
1910
|
var $;
|
|
@@ -1926,20 +1940,6 @@ var $;
|
|
|
1926
1940
|
;
|
|
1927
1941
|
"use strict";
|
|
1928
1942
|
var $;
|
|
1929
|
-
(function ($_1) {
|
|
1930
|
-
$mol_test({
|
|
1931
|
-
'FQN of anon function'($) {
|
|
1932
|
-
const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
|
|
1933
|
-
$mol_assert_equal($$.$mol_func_name_test.name, '');
|
|
1934
|
-
$mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
|
|
1935
|
-
$mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
|
|
1936
|
-
},
|
|
1937
|
-
});
|
|
1938
|
-
})($ || ($ = {}));
|
|
1939
|
-
//mol/func/name/name.test.ts
|
|
1940
|
-
;
|
|
1941
|
-
"use strict";
|
|
1942
|
-
var $;
|
|
1943
1943
|
(function ($) {
|
|
1944
1944
|
$mol_test({
|
|
1945
1945
|
'escape'() {
|