Skip to content

Commit 4027c3e

Browse files
committed
updates
1 parent ac1abb6 commit 4027c3e

File tree

15 files changed

+199
-178
lines changed

15 files changed

+199
-178
lines changed

test/parsebox/static/array.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// deno-fmt-ignore-file
2+
3+
import { Static } from '@sinclair/parsebox'
4+
function Assert<Left, _Right extends Left>(): void {}
5+
6+
// ------------------------------------------------------------------
7+
// Array
8+
// ------------------------------------------------------------------
9+
Assert<Static.Parse<Static.Array<Static.Const<'A'>>, ''>, [[], '']>()
10+
Assert<Static.Parse<Static.Array<Static.Const<'A'>>, 'AB'>, [['A'], 'B']>()
11+
Assert<Static.Parse<Static.Array<Static.Const<'A'>>, 'AAB'>, [['A', 'A'], 'B']>()
12+
Assert<Static.Parse<Static.Array<Static.Const<'AA'>>, 'AAB'>, [['AA'], 'B']>()
13+
Assert<Static.Parse<Static.Array<Static.Const<'AA'>>, 'AAAB'>, [['AA'], 'AB']>()
14+
Assert<Static.Parse<Static.Array<Static.Const<'AA'>>, 'B'>, [[], 'B']>()

test/parsebox/static/bigint.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// deno-fmt-ignore-file
2+
3+
import { Static } from '@sinclair/parsebox'
4+
function Assert<Left, _Right extends Left>(): void {}

test/parsebox/static/const.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// deno-fmt-ignore-file
2+
3+
import { Static } from '@sinclair/parsebox'
4+
function Assert<Left, _Right extends Left>(): void {}
5+
6+
Assert<Static.Parse<Static.Const<'A'>, ''>, []>()
7+
Assert<Static.Parse<Static.Const<'A'>, 'A'>, ['A', '']>()
8+
Assert<Static.Parse<Static.Const<'A'>, ' A'>, ['A', '']>()
9+
Assert<Static.Parse<Static.Const<'A'>, ' A '>, ['A', ' ']>()

test/parsebox/static/ident.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// deno-fmt-ignore-file
2+
3+
import { Static } from '@sinclair/parsebox'
4+
function Assert<Left, _Right extends Left>(): void {}
5+
6+
Assert<Static.Parse<Static.Ident, ''>, []>()
7+
Assert<Static.Parse<Static.Ident, '0'>, []>()
8+
Assert<Static.Parse<Static.Ident, '#'>, []>()
9+
Assert<Static.Parse<Static.Ident, '_'>, ['_', '']>()
10+
Assert<Static.Parse<Static.Ident, ' _'>, ['_', '']>()
11+
Assert<Static.Parse<Static.Ident, '_ '>, ['_', ' ']>()
12+
Assert<Static.Parse<Static.Ident, ' _ '>, ['_', ' ']>()
13+
Assert<Static.Parse<Static.Ident, '$'>, ['$', '']>()
14+
Assert<Static.Parse<Static.Ident, ' $'>, ['$', '']>()
15+
Assert<Static.Parse<Static.Ident, '$ '>, ['$', ' ']>()
16+
Assert<Static.Parse<Static.Ident, ' $ '>, ['$', ' ']>()
17+
Assert<Static.Parse<Static.Ident, 'A'>, ['A', '']>()
18+
Assert<Static.Parse<Static.Ident, ' A'>, ['A', '']>()
19+
Assert<Static.Parse<Static.Ident, 'A '>, ['A', ' ']>()
20+
Assert<Static.Parse<Static.Ident, ' A '>, ['A', ' ']>()
21+
Assert<Static.Parse<Static.Ident, 'A1'>, ['A1', '']>()
22+
Assert<Static.Parse<Static.Ident, ' A1'>, ['A1', '']>()
23+
Assert<Static.Parse<Static.Ident, 'A1 '>, ['A1', ' ']>()
24+
Assert<Static.Parse<Static.Ident, ' A1 '>, ['A1', ' ']>()

test/parsebox/static/integer.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// deno-fmt-ignore-file
2+
3+
import { Static } from '@sinclair/parsebox'
4+
function Assert<Left, _Right extends Left>(): void {}

test/parsebox/static/number.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// deno-fmt-ignore-file
2+
3+
import { Static } from '@sinclair/parsebox'
4+
function Assert<Left, _Right extends Left>(): void {}
5+
6+
Assert<Static.Parse<Static.Number, ''>, []>()
7+
Assert<Static.Parse<Static.Number, '01'>, ['0', '1']>()
8+
Assert<Static.Parse<Static.Number, ' 01'>, ['0', '1']>()
9+
Assert<Static.Parse<Static.Number, '01 '>, ['0', '1 ']>()
10+
Assert<Static.Parse<Static.Number, ' 01 '>, ['0', '1 ']>()
11+
Assert<Static.Parse<Static.Number, '0'>, ['0', '']>()
12+
Assert<Static.Parse<Static.Number, '0 '>, ['0', ' ']>()
13+
Assert<Static.Parse<Static.Number, ' 0'>, ['0', '']>()
14+
Assert<Static.Parse<Static.Number, ' 0 '>, ['0', ' ']>()
15+
Assert<Static.Parse<Static.Number, '-0'>, ['-0', '']>()
16+
Assert<Static.Parse<Static.Number, '-0 '>, ['-0', ' ']>()
17+
Assert<Static.Parse<Static.Number, ' -0'>, ['-0', '']>()
18+
Assert<Static.Parse<Static.Number, ' -0 '>, ['-0', ' ']>()
19+
Assert<Static.Parse<Static.Number, '100'>, ['100', '']>()
20+
Assert<Static.Parse<Static.Number, '100 '>, ['100', ' ']>()
21+
Assert<Static.Parse<Static.Number, ' 100'>, ['100', '']>()
22+
Assert<Static.Parse<Static.Number, ' 100 '>, ['100', ' ']>()
23+
Assert<Static.Parse<Static.Number, '-100'>, ['-100', '']>()
24+
Assert<Static.Parse<Static.Number, '-100 '>, ['-100', ' ']>()
25+
Assert<Static.Parse<Static.Number, ' -100'>, ['-100', '']>()
26+
Assert<Static.Parse<Static.Number, ' -100 '>, ['-100', ' ']>()
27+
Assert<Static.Parse<Static.Number, '0.1'>, ['0.1', '']>()
28+
Assert<Static.Parse<Static.Number, '0.1 '>, ['0.1', ' ']>()
29+
Assert<Static.Parse<Static.Number, ' 0.1'>, ['0.1', '']>()
30+
Assert<Static.Parse<Static.Number, ' 0.1 '>, ['0.1', ' ']>()
31+
Assert<Static.Parse<Static.Number, '100.1'>, ['100.1', '']>()
32+
Assert<Static.Parse<Static.Number, '100.1 '>, ['100.1', ' ']>()
33+
Assert<Static.Parse<Static.Number, ' 100.1'>, ['100.1', '']>()
34+
Assert<Static.Parse<Static.Number, ' 100.1 '>, ['100.1', ' ']>()
35+
Assert<Static.Parse<Static.Number, '-100.1'>, ['-100.1', '']>()
36+
Assert<Static.Parse<Static.Number, '-100.1 '>, ['-100.1', ' ']>()
37+
Assert<Static.Parse<Static.Number, ' -100.1'>, ['-100.1', '']>()
38+
Assert<Static.Parse<Static.Number, ' -100.1 '>, ['-100.1', ' ']>()
39+
Assert<Static.Parse<Static.Number, '100.1.1'>, ['100.1', '.1']>()
40+
Assert<Static.Parse<Static.Number, '100.1.1 '>, ['100.1', '.1 ']>()
41+
Assert<Static.Parse<Static.Number, ' 100.1.1'>, ['100.1', '.1']>()
42+
Assert<Static.Parse<Static.Number, ' 100.1.1 '>, ['100.1', '.1 ']>()
43+
Assert<Static.Parse<Static.Number, '-.1'>, ['-0.1', '']>()
44+
Assert<Static.Parse<Static.Number, '-.1 '>, ['-0.1', ' ']>()
45+
Assert<Static.Parse<Static.Number, ' -.1'>, ['-0.1', '']>()
46+
Assert<Static.Parse<Static.Number, ' -.1 '>, ['-0.1', ' ']>()
47+
Assert<Static.Parse<Static.Number, '-0.1'>, ['-0.1', '']>()
48+
Assert<Static.Parse<Static.Number, '-0.1 '>, ['-0.1', ' ']>()
49+
Assert<Static.Parse<Static.Number, ' -0.1'>, ['-0.1', '']>()
50+
Assert<Static.Parse<Static.Number, ' -0.1 '>, ['-0.1', ' ']>()

test/parsebox/static/optional.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// deno-fmt-ignore-file
2+
3+
import { Static } from '@sinclair/parsebox'
4+
function Assert<Left, _Right extends Left>(): void {}
5+
6+
Assert<Static.Parse<Static.Optional<Static.Const<'A'>>, ''>, [[], '']>()
7+
Assert<Static.Parse<Static.Optional<Static.Const<'A'>>, 'A'>, [['A'], '']>()
8+
Assert<Static.Parse<Static.Optional<Static.Const<'A'>>, 'AA'>, [['A'], 'A']>()
9+
Assert<Static.Parse<Static.Optional<Static.Const<'A'>>, 'B'>, [[], 'B']>()

test/parsebox/static/parse.ts

Lines changed: 0 additions & 178 deletions
This file was deleted.

test/parsebox/static/ref.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// deno-fmt-ignore-file
2+
3+
import { Static } from '@sinclair/parsebox'
4+
function Assert<Left, _Right extends Left>(): void {}

test/parsebox/static/string.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// deno-fmt-ignore-file
2+
3+
import { Static } from '@sinclair/parsebox'
4+
function Assert<Left, _Right extends Left>(): void {}
5+
6+
Assert<Static.Parse<Static.String<[`'`, `"`]>, ''>, []>()
7+
Assert<Static.Parse<Static.String<[`'`, `"`]>, '"A"'>, ['A', '']>()
8+
Assert<Static.Parse<Static.String<[`'`, `"`]>, ' "A"'>, ['A', '']>()
9+
Assert<Static.Parse<Static.String<[`'`, `"`]>, '"A" '>, ['A', ' ']>()
10+
Assert<Static.Parse<Static.String<[`'`, `"`]>, ' "A" '>, ['A', ' ']>()

0 commit comments

Comments
 (0)