@@ -51,7 +51,7 @@ test('isLiteral()', function (t) {
51
51
} , 'should work on single word sentences' )
52
52
53
53
t . doesNotThrow ( function ( ) {
54
- ; [
54
+ var fixtures = [
55
55
'Foo - is meant as a literal.' ,
56
56
'Foo – is meant as a literal.' ,
57
57
'Foo — is meant as a literal.' ,
@@ -61,15 +61,18 @@ test('isLiteral()', function (t) {
61
61
'Foo—is meant as a literal.' ,
62
62
'Foo: is meant as a literal.' ,
63
63
'Foo; is meant as a literal.'
64
- ] . forEach ( function ( fixture ) {
65
- process ( fixture , function ( node , index , parent ) {
66
- assert . strictEqual ( isLiteral ( parent , index ) , index === 0 , fixture )
64
+ ]
65
+ var index = - 1
66
+
67
+ while ( ++ index < fixtures . length ) {
68
+ process ( fixtures [ index ] , function ( node , index , parent ) {
69
+ assert . strictEqual ( isLiteral ( parent , index ) , index === 0 , index )
67
70
} )
68
- } )
71
+ }
69
72
} , 'Initial' )
70
73
71
74
t . doesNotThrow ( function ( ) {
72
- ; [
75
+ var fixtures = [
73
76
'Meant as a literal is - foo.' ,
74
77
'Meant as a literal is – foo.' ,
75
78
'Meant as a literal is — foo.' ,
@@ -79,19 +82,22 @@ test('isLiteral()', function (t) {
79
82
'Meant as a literal is—foo.' ,
80
83
'Meant as a literal is: foo.' ,
81
84
'Meant as a literal is; foo.'
82
- ] . forEach ( function ( fixture ) {
83
- process ( fixture , function ( node , index , parent ) {
85
+ ]
86
+ var index = - 1
87
+
88
+ while ( ++ index < fixtures . length ) {
89
+ process ( fixtures [ index ] , function ( node , index , parent ) {
84
90
assert . strictEqual (
85
91
isLiteral ( parent , index ) ,
86
92
index === parent . children . length - 2 ,
87
- fixture
93
+ index
88
94
)
89
95
} )
90
- } )
96
+ }
91
97
} , 'Final' )
92
98
93
99
t . doesNotThrow ( function ( ) {
94
- ; [
100
+ var fixtures = [
95
101
'The word, foo, is meant as a literal.' ,
96
102
'The word -foo- is meant as a literal.' ,
97
103
'The word –foo– is meant as a literal.' ,
@@ -118,23 +124,26 @@ test('isLiteral()', function (t) {
118
124
'The word {foo} is meant as a literal.' ,
119
125
'The word ⟨foo⟩ is meant as a literal.' ,
120
126
'The word 「foo」 is meant as a literal.'
121
- ] . forEach ( function ( fixture , n ) {
122
- process ( fixture , function ( node , index , parent ) {
127
+ ]
128
+ var index = - 1
129
+
130
+ while ( ++ index < fixtures . length ) {
131
+ process ( fixtures [ index ] , function ( node , place , parent ) {
123
132
var pos = 5
124
133
125
134
// Adjacent hyphens are part of the word.
126
- if ( n === 1 ) {
135
+ if ( index === 1 ) {
127
136
pos = 4
128
137
}
129
138
130
139
// Tests for extra spaces.
131
- if ( n === 4 || n === 5 || n === 6 ) {
140
+ if ( index === 4 || index === 5 || index === 6 ) {
132
141
pos = 6
133
142
}
134
143
135
- assert . strictEqual ( isLiteral ( parent , index ) , index === pos , fixture )
144
+ assert . strictEqual ( isLiteral ( parent , place ) , place === pos , index )
136
145
} )
137
- } )
146
+ }
138
147
} , 'Internal' )
139
148
140
149
t . end ( )
0 commit comments