Skip to content

Commit ab1e0c3

Browse files
committed
Docs & test fixes
1 parent b880f87 commit ab1e0c3

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# TwoFold (2✂︎f) changelog
22

3+
## v0.13 WIP
4+
5+
...
6+
37
## v0.12
48

59
- completely rewritten tag evaluation. This gives tag functions even more power.

test/tags.test.ts

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { testing } from './wrap.ts';
22
const { test, expect } = await testing;
33
import AST from '../src/parser.ts';
4-
import { getText, syncTag, unParse } from '../src/tags.ts';
4+
import { getText, syncTag } from '../src/tags.ts';
55

66
test('raw text getText', () => {
77
const txt = ' blah blah...';
@@ -19,53 +19,60 @@ test('single tag getText', () => {
1919

2020
test('raw text parse unparse', () => {
2121
const txt = ' blah blah...';
22-
const ast = new AST().parse(txt);
23-
const final = unParse(ast[0]);
22+
const ast = new AST();
23+
ast.parse(txt);
24+
const final = ast.unParse();
2425
expect(final).toBe(txt);
2526
});
2627

2728
test('single tag parse unparse', () => {
2829
const txt = '<stuff />';
29-
const ast = new AST().parse(txt);
30-
const final = unParse(ast[0]);
30+
const ast = new AST();
31+
ast.parse(txt);
32+
const final = ast.unParse();
3133
expect(final).toBe(txt);
3234
});
3335

3436
test('double tag parse unparse 1', () => {
3537
const txt = '<stuff></stuff>';
36-
const ast = new AST().parse(txt);
37-
const final = unParse(ast[0]);
38+
const ast = new AST();
39+
ast.parse(txt);
40+
const final = ast.unParse();
3841
expect(final).toBe(txt);
3942
});
4043

4144
test('double tag parse unparse 2', () => {
4245
const txt = '<stuff>??? </stuff>';
43-
const ast = new AST().parse(txt);
44-
const final = unParse(ast[0]);
46+
const ast = new AST();
47+
ast.parse(txt);
48+
const final = ast.unParse();
4549
expect(final).toBe(txt);
4650
});
4751

4852
test('parse unparse 1', () => {
4953
let txt = '<mumu a=b><mumu><mumu><text>0</text>';
5054
txt += '\n</mumu></mumu></mumu>';
51-
const ast = new AST().parse(txt);
52-
const final = unParse(ast[0]);
55+
const ast = new AST();
56+
ast.parse(txt);
57+
const final = ast.unParse();
5358
expect(final).toBe(txt);
5459
});
5560

5661
test('parse unparse 2', () => {
5762
let txt = '';
5863
txt += '<div><span class="title">Hello</span> <br />\n';
5964
txt += '<span class="text">Workd</span> <br />\n</div>';
60-
const ast = new AST().parse(txt);
61-
const final = unParse(ast[0]);
65+
const ast = new AST();
66+
ast.parse(txt);
67+
const final = ast.unParse();
6268
expect(final).toBe(txt);
6369
});
6470

6571
test('parse unparse 3', () => {
6672
const txt = '<noop>1<noop>2</noop>3</noop>';
67-
const ast = new AST().parse(txt);
68-
const final = unParse(ast[0]);
73+
const ast = new AST();
74+
ast.parse(txt);
75+
const final = ast.unParse();
6976
expect(final).toBe(txt);
7077
});
7178

0 commit comments

Comments
 (0)