@@ -17,19 +17,16 @@ Deno.test("AST all distinct", () => {
17
17
}
18
18
}
19
19
} ) ;
20
-
21
20
Deno . test ( "parser all error" , ( ) => {
22
21
for ( const sentence of MALFORMED_SENTENCES ) {
23
22
assertThrows ( ( ) => parser . parse ( sentence ) . unwrap ( ) ) ;
24
23
}
25
24
} ) ;
26
-
27
25
Deno . test ( "ucsur have proper length" , ( ) => {
28
26
assertEquals ( PU . length , 120 ) ;
29
27
assertEquals ( KU_SULI . length , 17 ) ;
30
28
assertEquals ( KU_LILI . length , 4 ) ;
31
29
} ) ;
32
-
33
30
Deno . test ( "ucsur ordered" , ( ) => {
34
31
for ( const [ i , word ] of PU . entries ( ) ) {
35
32
if ( i < PU . length - 1 ) {
@@ -38,19 +35,16 @@ Deno.test("ucsur ordered", () => {
38
35
}
39
36
}
40
37
} ) ;
41
-
42
38
Deno . test ( "no ali" , ( ) => {
43
39
for ( const word of PU ) {
44
40
assertNotEquals ( word , "ali" ) ;
45
41
}
46
42
} ) ;
47
-
48
43
function uniquePairs < T > (
49
44
array : ReadonlyArray < T > ,
50
45
) : ReadonlyArray < readonly [ T , T ] > {
51
46
return array . flatMap ( ( a , i ) => array . slice ( i + 1 ) . map ( ( b ) => [ a , b ] ) ) ;
52
47
}
53
-
54
48
Deno . test ( "small parser" , ( ) => {
55
49
const space = match ( / \s * / , "space" ) ;
56
50
const parser = sequence (
@@ -60,13 +54,11 @@ Deno.test("small parser", () => {
60
54
) ;
61
55
assertEquals ( parser . parse ( "toki pona a" ) . unwrap ( ) , [ [ "toki" , "pona" , "a" ] ] ) ;
62
56
} ) ;
63
-
64
57
Deno . test ( "many" , ( ) => {
65
58
const space = match ( / \s * / , "space" ) ;
66
59
const parser = many ( matchString ( "a" ) . skip ( space ) ) . skip ( end ) ;
67
60
assertEquals ( parser . parse ( "a a a" ) . unwrap ( ) , [ [ "a" , "a" , "a" ] ] ) ;
68
61
} ) ;
69
-
70
62
Deno . test ( "all" , ( ) => {
71
63
const space = match ( / \s * / , "space" ) ;
72
64
const parser = all ( matchString ( "a" ) . skip ( space ) ) . skip ( end ) ;
0 commit comments