mol_tree2 1.0.213 → 1.0.215

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/web.test.js CHANGED
@@ -165,9 +165,6 @@ var $;
165
165
  //mol/dom/render/children/children.ts
166
166
  ;
167
167
  "use strict";
168
- //mol/type/partial/deep/deep.ts
169
- ;
170
- "use strict";
171
168
  //mol/type/error/error.ts
172
169
  ;
173
170
  "use strict";
@@ -177,106 +174,13 @@ var $;
177
174
  //mol/type/assert/assert.test.ts
178
175
  ;
179
176
  "use strict";
180
- //mol/type/equals/equals.ts
181
- ;
182
- "use strict";
183
- //mol/type/equals/equals.test.ts
177
+ //mol/type/partial/deep/deep.ts
184
178
  ;
185
179
  "use strict";
186
180
  //mol/type/partial/deep/deep.test.ts
187
181
  ;
188
182
  "use strict";
189
183
  var $;
190
- (function ($) {
191
- $mol_test({
192
- 'Make empty div'() {
193
- $mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
194
- },
195
- 'Define native field'() {
196
- const dom = $mol_jsx("input", { value: '123' });
197
- $mol_assert_equal(dom.outerHTML, '<input value="123">');
198
- $mol_assert_equal(dom.value, '123');
199
- },
200
- 'Define classes'() {
201
- const dom = $mol_jsx("div", { class: 'foo bar' });
202
- $mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
203
- },
204
- 'Define styles'() {
205
- const dom = $mol_jsx("div", { style: { color: 'red' } });
206
- $mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
207
- },
208
- 'Define dataset'() {
209
- const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
210
- $mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
211
- },
212
- 'Define attributes'() {
213
- const dom = $mol_jsx("div", { lang: "ru", hidden: true });
214
- $mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
215
- },
216
- 'Define child nodes'() {
217
- const dom = $mol_jsx("div", null,
218
- "hello",
219
- $mol_jsx("strong", null, "world"),
220
- "!");
221
- $mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
222
- },
223
- 'Function as component'() {
224
- const Button = (props, target) => {
225
- return $mol_jsx("button", { title: props.hint }, target());
226
- };
227
- const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
228
- $mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
229
- },
230
- 'Nested guid generation'() {
231
- const Foo = () => {
232
- return $mol_jsx("div", null,
233
- $mol_jsx(Bar, { id: "bar" },
234
- $mol_jsx("img", { id: "icon" })));
235
- };
236
- const Bar = (props, icon) => {
237
- return $mol_jsx("span", null,
238
- icon,
239
- $mol_jsx("i", { id: "label" }));
240
- };
241
- const dom = $mol_jsx(Foo, { id: "foo" });
242
- $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>');
243
- },
244
- 'Fail on non unique ids'() {
245
- const App = () => {
246
- return $mol_jsx("div", null,
247
- $mol_jsx("span", { id: "bar" }),
248
- $mol_jsx("span", { id: "bar" }));
249
- };
250
- $mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
251
- },
252
- 'Owner based guid generationn'() {
253
- const Foo = () => {
254
- return $mol_jsx("div", null,
255
- $mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
256
- };
257
- const Bar = (props) => {
258
- return $mol_jsx("span", null, props.icon());
259
- };
260
- const dom = $mol_jsx(Foo, { id: "app" });
261
- $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>');
262
- },
263
- 'Fail on same ids from different caller'() {
264
- const Foo = () => {
265
- return $mol_jsx("div", null,
266
- $mol_jsx("img", { id: "icon" }),
267
- $mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
268
- };
269
- const Bar = (props) => {
270
- return $mol_jsx("span", null, props.icon());
271
- };
272
- $mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
273
- },
274
- });
275
- })($ || ($ = {}));
276
- //mol/jsx/jsx.test.tsx
277
- ;
278
- "use strict";
279
- var $;
280
184
  (function ($) {
281
185
  $.$mol_jsx_prefix = '';
282
186
  $.$mol_jsx_crumbs = '';
@@ -400,97 +304,91 @@ var $;
400
304
  var $;
401
305
  (function ($) {
402
306
  $mol_test({
403
- 'nulls & undefineds'() {
404
- $mol_assert_ok($mol_compare_deep(null, null));
405
- $mol_assert_ok($mol_compare_deep(undefined, undefined));
406
- $mol_assert_not($mol_compare_deep(undefined, null));
407
- $mol_assert_not($mol_compare_deep({}, null));
408
- },
409
- 'number'() {
410
- $mol_assert_ok($mol_compare_deep(1, 1));
411
- $mol_assert_ok($mol_compare_deep(Number.NaN, Number.NaN));
412
- $mol_assert_not($mol_compare_deep(1, 2));
413
- $mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
414
- $mol_assert_not($mol_compare_deep(Object(1), Object(2)));
307
+ 'Make empty div'() {
308
+ $mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
415
309
  },
416
- 'POJO'() {
417
- $mol_assert_ok($mol_compare_deep({}, {}));
418
- $mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
419
- $mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
420
- $mol_assert_not($mol_compare_deep({}, { a: undefined }));
421
- $mol_assert_ok($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
422
- $mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
310
+ 'Define native field'() {
311
+ const dom = $mol_jsx("input", { value: '123' });
312
+ $mol_assert_equal(dom.outerHTML, '<input value="123">');
313
+ $mol_assert_equal(dom.value, '123');
423
314
  },
424
- 'Array'() {
425
- $mol_assert_ok($mol_compare_deep([], []));
426
- $mol_assert_ok($mol_compare_deep([1, [2]], [1, [2]]));
427
- $mol_assert_not($mol_compare_deep([1, 2], [1, 3]));
428
- $mol_assert_not($mol_compare_deep([1, 2,], [1, 3, undefined]));
315
+ 'Define classes'() {
316
+ const dom = $mol_jsx("div", { class: 'foo bar' });
317
+ $mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
429
318
  },
430
- 'Non POJO are different'() {
431
- class Thing extends Object {
432
- }
433
- $mol_assert_not($mol_compare_deep(new Thing, new Thing));
434
- $mol_assert_not($mol_compare_deep(() => 1, () => 1));
435
- $mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
319
+ 'Define styles'() {
320
+ const dom = $mol_jsx("div", { style: { color: 'red' } });
321
+ $mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
436
322
  },
437
- 'same POJOs with cyclic reference'() {
438
- const a = { foo: {} };
439
- a['self'] = a;
440
- const b = { foo: {} };
441
- b['self'] = b;
442
- $mol_assert_ok($mol_compare_deep(a, b));
323
+ 'Define dataset'() {
324
+ const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
325
+ $mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
443
326
  },
444
- 'Date'() {
445
- $mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
446
- $mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));
327
+ 'Define attributes'() {
328
+ const dom = $mol_jsx("div", { lang: "ru", hidden: true });
329
+ $mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
447
330
  },
448
- 'RegExp'() {
449
- $mol_assert_ok($mol_compare_deep(/\x22/mig, /\x22/mig));
450
- $mol_assert_not($mol_compare_deep(/\x22/mig, /\x21/mig));
451
- $mol_assert_not($mol_compare_deep(/\x22/mig, /\x22/mg));
331
+ 'Define child nodes'() {
332
+ const dom = $mol_jsx("div", null,
333
+ "hello",
334
+ $mol_jsx("strong", null, "world"),
335
+ "!");
336
+ $mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
452
337
  },
453
- 'Error'() {
454
- $mol_assert_not($mol_compare_deep(new Error('xxx'), new Error('xxx')));
455
- const fail = (message) => new Error(message);
456
- $mol_assert_ok($mol_compare_deep(...['xxx', 'xxx'].map(msg => new Error(msg))));
457
- $mol_assert_not($mol_compare_deep(...['xxx', 'yyy'].map(msg => new Error(msg))));
338
+ 'Function as component'() {
339
+ const Button = (props, target) => {
340
+ return $mol_jsx("button", { title: props.hint }, target());
341
+ };
342
+ const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
343
+ $mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
458
344
  },
459
- 'Map'() {
460
- $mol_assert_ok($mol_compare_deep(new Map, new Map));
461
- $mol_assert_ok($mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
462
- $mol_assert_ok($mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
463
- $mol_assert_not($mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
464
- $mol_assert_not($mol_compare_deep(new Map([[[1], 2]]), new Map([[[3], 2]])));
345
+ 'Nested guid generation'() {
346
+ const Foo = () => {
347
+ return $mol_jsx("div", null,
348
+ $mol_jsx(Bar, { id: "bar" },
349
+ $mol_jsx("img", { id: "icon" })));
350
+ };
351
+ const Bar = (props, icon) => {
352
+ return $mol_jsx("span", null,
353
+ icon,
354
+ $mol_jsx("i", { id: "label" }));
355
+ };
356
+ const dom = $mol_jsx(Foo, { id: "foo" });
357
+ $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>');
465
358
  },
466
- 'Set'() {
467
- $mol_assert_ok($mol_compare_deep(new Set, new Set));
468
- $mol_assert_ok($mol_compare_deep(new Set([1, [2]]), new Set([1, [2]])));
469
- $mol_assert_not($mol_compare_deep(new Set([1]), new Set([2])));
359
+ 'Fail on non unique ids'() {
360
+ const App = () => {
361
+ return $mol_jsx("div", null,
362
+ $mol_jsx("span", { id: "bar" }),
363
+ $mol_jsx("span", { id: "bar" }));
364
+ };
365
+ $mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
470
366
  },
471
- 'Uint8Array'() {
472
- $mol_assert_ok($mol_compare_deep(new Uint8Array, new Uint8Array));
473
- $mol_assert_ok($mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
474
- $mol_assert_not($mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
367
+ 'Owner based guid generationn'() {
368
+ const Foo = () => {
369
+ return $mol_jsx("div", null,
370
+ $mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
371
+ };
372
+ const Bar = (props) => {
373
+ return $mol_jsx("span", null, props.icon());
374
+ };
375
+ const dom = $mol_jsx(Foo, { id: "app" });
376
+ $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>');
475
377
  },
476
- 'Custom comparator'() {
477
- class User {
478
- name;
479
- rand;
480
- constructor(name, rand = Math.random()) {
481
- this.name = name;
482
- this.rand = rand;
483
- }
484
- [Symbol.toPrimitive](mode) {
485
- return this.name;
486
- }
487
- }
488
- $mol_assert_ok($mol_compare_deep(new User('Jin'), new User('Jin')));
489
- $mol_assert_not($mol_compare_deep(new User('Jin'), new User('John')));
378
+ 'Fail on same ids from different caller'() {
379
+ const Foo = () => {
380
+ return $mol_jsx("div", null,
381
+ $mol_jsx("img", { id: "icon" }),
382
+ $mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
383
+ };
384
+ const Bar = (props) => {
385
+ return $mol_jsx("span", null, props.icon());
386
+ };
387
+ $mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
490
388
  },
491
389
  });
492
390
  })($ || ($ = {}));
493
- //mol/compare/deep/deep.test.tsx
391
+ //mol/jsx/jsx.test.tsx
494
392
  ;
495
393
  "use strict";
496
394
  var $;
@@ -619,6 +517,102 @@ var $;
619
517
  ;
620
518
  "use strict";
621
519
  var $;
520
+ (function ($) {
521
+ $mol_test({
522
+ 'nulls & undefineds'() {
523
+ $mol_assert_ok($mol_compare_deep(null, null));
524
+ $mol_assert_ok($mol_compare_deep(undefined, undefined));
525
+ $mol_assert_not($mol_compare_deep(undefined, null));
526
+ $mol_assert_not($mol_compare_deep({}, null));
527
+ },
528
+ 'number'() {
529
+ $mol_assert_ok($mol_compare_deep(1, 1));
530
+ $mol_assert_ok($mol_compare_deep(Number.NaN, Number.NaN));
531
+ $mol_assert_not($mol_compare_deep(1, 2));
532
+ $mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
533
+ $mol_assert_not($mol_compare_deep(Object(1), Object(2)));
534
+ },
535
+ 'POJO'() {
536
+ $mol_assert_ok($mol_compare_deep({}, {}));
537
+ $mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
538
+ $mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
539
+ $mol_assert_not($mol_compare_deep({}, { a: undefined }));
540
+ $mol_assert_ok($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
541
+ $mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
542
+ },
543
+ 'Array'() {
544
+ $mol_assert_ok($mol_compare_deep([], []));
545
+ $mol_assert_ok($mol_compare_deep([1, [2]], [1, [2]]));
546
+ $mol_assert_not($mol_compare_deep([1, 2], [1, 3]));
547
+ $mol_assert_not($mol_compare_deep([1, 2,], [1, 3, undefined]));
548
+ },
549
+ 'Non POJO are different'() {
550
+ class Thing extends Object {
551
+ }
552
+ $mol_assert_not($mol_compare_deep(new Thing, new Thing));
553
+ $mol_assert_not($mol_compare_deep(() => 1, () => 1));
554
+ $mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
555
+ },
556
+ 'same POJOs with cyclic reference'() {
557
+ const a = { foo: {} };
558
+ a['self'] = a;
559
+ const b = { foo: {} };
560
+ b['self'] = b;
561
+ $mol_assert_ok($mol_compare_deep(a, b));
562
+ },
563
+ 'Date'() {
564
+ $mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
565
+ $mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));
566
+ },
567
+ 'RegExp'() {
568
+ $mol_assert_ok($mol_compare_deep(/\x22/mig, /\x22/mig));
569
+ $mol_assert_not($mol_compare_deep(/\x22/mig, /\x21/mig));
570
+ $mol_assert_not($mol_compare_deep(/\x22/mig, /\x22/mg));
571
+ },
572
+ 'Error'() {
573
+ $mol_assert_not($mol_compare_deep(new Error('xxx'), new Error('xxx')));
574
+ const fail = (message) => new Error(message);
575
+ $mol_assert_ok($mol_compare_deep(...['xxx', 'xxx'].map(msg => new Error(msg))));
576
+ $mol_assert_not($mol_compare_deep(...['xxx', 'yyy'].map(msg => new Error(msg))));
577
+ },
578
+ 'Map'() {
579
+ $mol_assert_ok($mol_compare_deep(new Map, new Map));
580
+ $mol_assert_ok($mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
581
+ $mol_assert_ok($mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
582
+ $mol_assert_not($mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
583
+ $mol_assert_not($mol_compare_deep(new Map([[[1], 2]]), new Map([[[3], 2]])));
584
+ },
585
+ 'Set'() {
586
+ $mol_assert_ok($mol_compare_deep(new Set, new Set));
587
+ $mol_assert_ok($mol_compare_deep(new Set([1, [2]]), new Set([1, [2]])));
588
+ $mol_assert_not($mol_compare_deep(new Set([1]), new Set([2])));
589
+ },
590
+ 'Uint8Array'() {
591
+ $mol_assert_ok($mol_compare_deep(new Uint8Array, new Uint8Array));
592
+ $mol_assert_ok($mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
593
+ $mol_assert_not($mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
594
+ },
595
+ 'Custom comparator'() {
596
+ class User {
597
+ name;
598
+ rand;
599
+ constructor(name, rand = Math.random()) {
600
+ this.name = name;
601
+ this.rand = rand;
602
+ }
603
+ [Symbol.toPrimitive](mode) {
604
+ return this.name;
605
+ }
606
+ }
607
+ $mol_assert_ok($mol_compare_deep(new User('Jin'), new User('Jin')));
608
+ $mol_assert_not($mol_compare_deep(new User('Jin'), new User('John')));
609
+ },
610
+ });
611
+ })($ || ($ = {}));
612
+ //mol/compare/deep/deep.test.tsx
613
+ ;
614
+ "use strict";
615
+ var $;
622
616
  (function ($) {
623
617
  function $mol_dom_serialize(node) {
624
618
  const serializer = new $mol_dom_context.XMLSerializer;
@@ -779,24 +773,16 @@ var $;
779
773
  //mol/log3/log3.ts
780
774
  ;
781
775
  "use strict";
782
- //mol/type/keys/extract/extract.ts
776
+ //mol/type/equals/equals.ts
783
777
  ;
784
778
  "use strict";
785
- //mol/type/keys/extract/extract.test.ts
779
+ //mol/type/equals/equals.test.ts
786
780
  ;
787
781
  "use strict";
788
- var $;
789
- (function ($_1) {
790
- $mol_test_mocks.push($ => {
791
- $.$mol_log3_come = () => { };
792
- $.$mol_log3_done = () => { };
793
- $.$mol_log3_fail = () => { };
794
- $.$mol_log3_warn = () => { };
795
- $.$mol_log3_rise = () => { };
796
- $.$mol_log3_area = () => () => { };
797
- });
798
- })($ || ($ = {}));
799
- //mol/log3/log3.test.ts
782
+ //mol/type/keys/extract/extract.ts
783
+ ;
784
+ "use strict";
785
+ //mol/type/keys/extract/extract.test.ts
800
786
  ;
801
787
  "use strict";
802
788
  var $;
@@ -829,6 +815,20 @@ var $;
829
815
  ;
830
816
  "use strict";
831
817
  var $;
818
+ (function ($_1) {
819
+ $mol_test_mocks.push($ => {
820
+ $.$mol_log3_come = () => { };
821
+ $.$mol_log3_done = () => { };
822
+ $.$mol_log3_fail = () => { };
823
+ $.$mol_log3_warn = () => { };
824
+ $.$mol_log3_rise = () => { };
825
+ $.$mol_log3_area = () => () => { };
826
+ });
827
+ })($ || ($ = {}));
828
+ //mol/log3/log3.test.ts
829
+ ;
830
+ "use strict";
831
+ var $;
832
832
  (function ($) {
833
833
  const named = new WeakSet();
834
834
  function $mol_func_name(func) {
@@ -993,64 +993,6 @@ var $;
993
993
  ;
994
994
  "use strict";
995
995
  var $;
996
- (function ($_1) {
997
- $mol_test({
998
- 'inserting'($) {
999
- $mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
1000
- .insert($mol_tree2.struct('x'), 'a', 'b', 'c')
1001
- .toString(), 'a b x\n');
1002
- $mol_assert_equal($.$mol_tree2_from_string('a b\n')
1003
- .insert($mol_tree2.struct('x'), 'a', 'b', 'c', 'd')
1004
- .toString(), 'a b c x\n');
1005
- $mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
1006
- .insert($mol_tree2.struct('x'), 0, 0, 0)
1007
- .toString(), 'a b x\n');
1008
- $mol_assert_equal($.$mol_tree2_from_string('a b\n')
1009
- .insert($mol_tree2.struct('x'), 0, 0, 0, 0)
1010
- .toString(), 'a b \\\n\tx\n');
1011
- $mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
1012
- .insert($mol_tree2.struct('x'), null, null, null)
1013
- .toString(), 'a b x\n');
1014
- $mol_assert_equal($.$mol_tree2_from_string('a b\n')
1015
- .insert($mol_tree2.struct('x'), null, null, null, null)
1016
- .toString(), 'a b \\\n\tx\n');
1017
- },
1018
- 'deleting'($) {
1019
- $mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
1020
- .insert(null, 'a', 'b', 'c')
1021
- .toString(), 'a b\n');
1022
- $mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
1023
- .insert(null, 0, 0, 0)
1024
- .toString(), 'a b\n');
1025
- },
1026
- 'hack'($) {
1027
- const res = $.$mol_tree2_from_string(`foo bar xxx\n`)
1028
- .hack({
1029
- 'bar': (input, belt) => [input.struct('777', input.hack(belt))],
1030
- });
1031
- $mol_assert_equal(res.toString(), 'foo 777 xxx\n');
1032
- },
1033
- });
1034
- })($ || ($ = {}));
1035
- //mol/tree2/tree2.test.ts
1036
- ;
1037
- "use strict";
1038
- var $;
1039
- (function ($) {
1040
- $mol_test({
1041
- 'fromJSON'() {
1042
- $mol_assert_equal($mol_tree2_from_json([]).toString(), '/\n');
1043
- $mol_assert_equal($mol_tree2_from_json([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
1044
- $mol_assert_equal($mol_tree2_from_json([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
1045
- $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');
1046
- $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');
1047
- },
1048
- });
1049
- })($ || ($ = {}));
1050
- //mol/tree2/from/json/json.test.ts
1051
- ;
1052
- "use strict";
1053
- var $;
1054
996
  (function ($_1) {
1055
997
  $mol_test({
1056
998
  'tree parsing'($) {
@@ -1114,6 +1056,64 @@ var $;
1114
1056
  //mol/tree2/from/string/string.test.ts
1115
1057
  ;
1116
1058
  "use strict";
1059
+ var $;
1060
+ (function ($_1) {
1061
+ $mol_test({
1062
+ 'inserting'($) {
1063
+ $mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
1064
+ .insert($mol_tree2.struct('x'), 'a', 'b', 'c')
1065
+ .toString(), 'a b x\n');
1066
+ $mol_assert_equal($.$mol_tree2_from_string('a b\n')
1067
+ .insert($mol_tree2.struct('x'), 'a', 'b', 'c', 'd')
1068
+ .toString(), 'a b c x\n');
1069
+ $mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
1070
+ .insert($mol_tree2.struct('x'), 0, 0, 0)
1071
+ .toString(), 'a b x\n');
1072
+ $mol_assert_equal($.$mol_tree2_from_string('a b\n')
1073
+ .insert($mol_tree2.struct('x'), 0, 0, 0, 0)
1074
+ .toString(), 'a b \\\n\tx\n');
1075
+ $mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
1076
+ .insert($mol_tree2.struct('x'), null, null, null)
1077
+ .toString(), 'a b x\n');
1078
+ $mol_assert_equal($.$mol_tree2_from_string('a b\n')
1079
+ .insert($mol_tree2.struct('x'), null, null, null, null)
1080
+ .toString(), 'a b \\\n\tx\n');
1081
+ },
1082
+ 'deleting'($) {
1083
+ $mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
1084
+ .insert(null, 'a', 'b', 'c')
1085
+ .toString(), 'a b\n');
1086
+ $mol_assert_equal($.$mol_tree2_from_string('a b c d\n')
1087
+ .insert(null, 0, 0, 0)
1088
+ .toString(), 'a b\n');
1089
+ },
1090
+ 'hack'($) {
1091
+ const res = $.$mol_tree2_from_string(`foo bar xxx\n`)
1092
+ .hack({
1093
+ 'bar': (input, belt) => [input.struct('777', input.hack(belt))],
1094
+ });
1095
+ $mol_assert_equal(res.toString(), 'foo 777 xxx\n');
1096
+ },
1097
+ });
1098
+ })($ || ($ = {}));
1099
+ //mol/tree2/tree2.test.ts
1100
+ ;
1101
+ "use strict";
1102
+ var $;
1103
+ (function ($) {
1104
+ $mol_test({
1105
+ 'fromJSON'() {
1106
+ $mol_assert_equal($mol_tree2_from_json([]).toString(), '/\n');
1107
+ $mol_assert_equal($mol_tree2_from_json([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
1108
+ $mol_assert_equal($mol_tree2_from_json([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
1109
+ $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');
1110
+ $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');
1111
+ },
1112
+ });
1113
+ })($ || ($ = {}));
1114
+ //mol/tree2/from/json/json.test.ts
1115
+ ;
1116
+ "use strict";
1117
1117
  //mol/type/unary/unary.ts
1118
1118
  ;
1119
1119
  "use strict";