@@ -10,9 +10,9 @@ import retext from 'retext'
10
10
import { visit } from 'unist-util-visit'
11
11
import { isLiteral } from './index.js'
12
12
13
- test ( 'isLiteral()' , function ( t ) {
13
+ test ( 'isLiteral()' , ( t ) => {
14
14
t . throws (
15
- function ( ) {
15
+ ( ) => {
16
16
// @ts -ignore runtime.
17
17
isLiteral ( )
18
18
} ,
@@ -21,7 +21,7 @@ test('isLiteral()', function (t) {
21
21
)
22
22
23
23
t . throws (
24
- function ( ) {
24
+ ( ) => {
25
25
// @ts -ignore runtime.
26
26
isLiteral ( { } )
27
27
} ,
@@ -30,7 +30,7 @@ test('isLiteral()', function (t) {
30
30
)
31
31
32
32
t . throws (
33
- function ( ) {
33
+ ( ) => {
34
34
// @ts -ignore runtime.
35
35
isLiteral ( { children : [ ] } )
36
36
} ,
@@ -39,31 +39,31 @@ test('isLiteral()', function (t) {
39
39
)
40
40
41
41
t . throws (
42
- function ( ) {
42
+ ( ) => {
43
43
// @ts -ignore runtime.
44
44
isLiteral ( { children : [ ] } , { type : 'a' } )
45
45
} ,
46
46
/ N o d e m u s t b e a c h i l d o f ` p a r e n t ` / ,
47
47
'should throw if `node` is not in `parent`'
48
48
)
49
49
50
- t . doesNotThrow ( function ( ) {
51
- var n = { type : 'a' }
50
+ t . doesNotThrow ( ( ) => {
51
+ const n = { type : 'a' }
52
52
// @ts -ignore runtime.
53
53
isLiteral ( { children : [ n ] } , n )
54
54
} , 'should not throw if `node` is in `parent`' )
55
55
56
- t . doesNotThrow ( function ( ) {
56
+ t . doesNotThrow ( ( ) => {
57
57
process (
58
58
'Well? Ha! Funky' ,
59
- /** @type {Visitor } */ function ( _ , index , parent ) {
59
+ /** @type {Visitor } */ ( _ , index , parent ) => {
60
60
assert . strictEqual ( isLiteral ( parent , index ) , false )
61
61
}
62
62
)
63
63
} , 'should work on single word sentences' )
64
64
65
- t . doesNotThrow ( function ( ) {
66
- var fixtures = [
65
+ t . doesNotThrow ( ( ) => {
66
+ const fixtures = [
67
67
'Foo - is meant as a literal.' ,
68
68
'Foo – is meant as a literal.' ,
69
69
'Foo — is meant as a literal.' ,
@@ -74,12 +74,12 @@ test('isLiteral()', function (t) {
74
74
'Foo: is meant as a literal.' ,
75
75
'Foo; is meant as a literal.'
76
76
]
77
- var index = - 1
77
+ let index = - 1
78
78
79
79
while ( ++ index < fixtures . length ) {
80
80
process (
81
81
fixtures [ index ] ,
82
- /** @type {Visitor } */ function ( _ , index , parent ) {
82
+ /** @type {Visitor } */ ( _ , index , parent ) => {
83
83
assert . strictEqual (
84
84
isLiteral ( parent , index ) ,
85
85
index === 0 ,
@@ -90,8 +90,8 @@ test('isLiteral()', function (t) {
90
90
}
91
91
} , 'Initial' )
92
92
93
- t . doesNotThrow ( function ( ) {
94
- var fixtures = [
93
+ t . doesNotThrow ( ( ) => {
94
+ const fixtures = [
95
95
'Meant as a literal is - foo.' ,
96
96
'Meant as a literal is – foo.' ,
97
97
'Meant as a literal is — foo.' ,
@@ -102,12 +102,12 @@ test('isLiteral()', function (t) {
102
102
'Meant as a literal is: foo.' ,
103
103
'Meant as a literal is; foo.'
104
104
]
105
- var index = - 1
105
+ let index = - 1
106
106
107
107
while ( ++ index < fixtures . length ) {
108
108
process (
109
109
fixtures [ index ] ,
110
- /** @type {Visitor } */ function ( _ , index , parent ) {
110
+ /** @type {Visitor } */ ( _ , index , parent ) => {
111
111
assert . strictEqual (
112
112
isLiteral ( parent , index ) ,
113
113
index === parent . children . length - 2 ,
@@ -118,8 +118,8 @@ test('isLiteral()', function (t) {
118
118
}
119
119
} , 'Final' )
120
120
121
- t . doesNotThrow ( function ( ) {
122
- var fixtures = [
121
+ t . doesNotThrow ( ( ) => {
122
+ const fixtures = [
123
123
'The word, foo, is meant as a literal.' ,
124
124
'The word -foo- is meant as a literal.' ,
125
125
'The word –foo– is meant as a literal.' ,
@@ -147,13 +147,13 @@ test('isLiteral()', function (t) {
147
147
'The word ⟨foo⟩ is meant as a literal.' ,
148
148
'The word 「foo」 is meant as a literal.'
149
149
]
150
- var index = - 1
150
+ let index = - 1
151
151
152
152
while ( ++ index < fixtures . length ) {
153
153
process (
154
154
fixtures [ index ] ,
155
- /** @type {Visitor } */ function ( _ , place , parent ) {
156
- var pos = 5
155
+ /** @type {Visitor } */ ( _ , place , parent ) => {
156
+ let pos = 5
157
157
158
158
// Adjacent hyphens are part of the word.
159
159
if ( index === 1 ) {
0 commit comments