Skip to content

Commit 55b5747

Browse files
committed
Fix spacing in StringReader.js tests
1 parent 74e41b6 commit 55b5747

File tree

1 file changed

+89
-89
lines changed

1 file changed

+89
-89
lines changed

tests/util/StringReader.js

+89-89
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
(function(){
2-
2+
33
var Assert = YUITest.Assert
44
StringReader = parserlib.util.StringReader;
5-
5+
66
//-------------------------------------------------------------------------
77
// Base Test Suite
88
//-------------------------------------------------------------------------
9-
9+
1010
var suite = new YUITest.TestSuite("StringReader");
11-
11+
1212
//-------------------------------------------------------------------------
1313
// Test Case for adding
1414
//-------------------------------------------------------------------------
15-
15+
1616
suite.add(new YUITest.TestCase({
17-
17+
1818
name : "read() Tests",
1919

2020
//---------------------------------------------------------------------
2121
// Tests
2222
//---------------------------------------------------------------------
23-
23+
2424
/*
2525
* Tests that reading a string with no new lines works.
2626
*/
@@ -29,21 +29,21 @@
2929
reader = new StringReader(testString),
3030
i = 0,
3131
c;
32-
32+
3333
Assert.areEqual(1, reader.getCol(), "Column should be 1.");
3434
c = reader.read();
35-
35+
3636
while(c){
37-
Assert.areEqual(testString.charAt(i), c, "Character at position " + i + " is incorrect.");
37+
Assert.areEqual(testString.charAt(i), c, "Character at position " + i + " is incorrect.");
3838
Assert.areEqual(i+2, reader.getCol(), "Column should be " + (i+2) + ".");
3939
c = reader.read();
4040
i++;
4141
}
42-
42+
4343
Assert.areEqual(testString.length, i, "All characters should be read.");
44-
Assert.isNull(c, "Last character read should be null.");
44+
Assert.isNull(c, "Last character read should be null.");
4545
},
46-
46+
4747
/*
4848
* Tests that reading a multi-line string works.
4949
*/
@@ -52,36 +52,36 @@
5252
reader = new StringReader(testString),
5353
i = 0,
5454
c = reader.read();
55-
55+
5656
while(c){
57-
Assert.areEqual(testString.charAt(i), c, "Character at position " + i + " is incorrect.");
57+
Assert.areEqual(testString.charAt(i), c, "Character at position " + i + " is incorrect.");
5858
if (c == "\n"){
5959
Assert.areEqual(2, reader.getLine(), "Should now be on second row.");
6060
Assert.areEqual(1, reader.getCol(), "The new line should cause you to go to first char in second row.");
61-
}
61+
}
6262
c = reader.read();
6363
i++;
6464
}
65-
66-
Assert.isNull(c, "Last character read should be null.");
65+
66+
Assert.isNull(c, "Last character read should be null.");
6767
},
6868

69-
69+
7070
/*
7171
* Tests that reading a multi-line string properly tracks rows and cols.
7272
*/
7373
testLinearReadWithTwoLinesTrackCols: function(){
7474
var testString = "Hello world!\nNice day, isn't it?",
7575
reader = new StringReader(testString);
76-
76+
7777
reader.readTo("!");
7878
reader.read();
79-
79+
8080
Assert.areEqual(1, reader.getCol());
8181
Assert.areEqual(2, reader.getLine());
82-
82+
8383
},
84-
84+
8585
/*
8686
* Tests that reading a multi-line string works when the last character is a new-line.
8787
*/
@@ -90,81 +90,81 @@
9090
reader = new StringReader(testString),
9191
i = 0,
9292
c = reader.read();
93-
93+
9494
while(c){
95-
Assert.areEqual(testString.charAt(i), c, "Character at position " + i + " is incorrect.");
95+
Assert.areEqual(testString.charAt(i), c, "Character at position " + i + " is incorrect.");
9696
c = reader.read();
9797
i++;
9898
}
99-
100-
Assert.isNull(c, "Last character read should be null.");
101-
}
102-
103-
104-
105-
99+
100+
Assert.isNull(c, "Last character read should be null.");
101+
}
102+
103+
104+
105+
106106
}));
107107

108108
//-------------------------------------------------------------------------
109109
// Test Case for readTo
110110
//-------------------------------------------------------------------------
111-
111+
112112
suite.add(new YUITest.TestCase({
113-
113+
114114
name : "readTo() Tests",
115115

116116

117117
//---------------------------------------------------------------------
118118
// Tests
119119
//---------------------------------------------------------------------
120-
120+
121121
/*
122122
* Tests that reading a string with no new lines works.
123123
*/
124124
testLinearReadToWithOneLine: function(){
125125
var testString = "Hello world!",
126126
reader = new StringReader(testString);
127-
128-
129-
Assert.areEqual("Hello ", reader.readTo(" "));
127+
128+
129+
Assert.areEqual("Hello ", reader.readTo(" "));
130130
Assert.areEqual("w", reader.read());
131131
},
132-
132+
133133
/*
134134
* Tests that reading a multi-line string works.
135135
*/
136136
testLinearReadToWithTwoLines: function(){
137137
var testString = "Hello world!\nNice day, isn't it?",
138138
reader = new StringReader(testString);
139-
140-
141-
Assert.areEqual("Hello world!\nN", reader.readTo("N"));
139+
140+
141+
Assert.areEqual("Hello world!\nN", reader.readTo("N"));
142142
Assert.areEqual(2, reader.getLine());
143143
Assert.areEqual(2, reader.getCol());
144144
}
145-
146-
}));
147-
145+
146+
}));
147+
148148
//-------------------------------------------------------------------------
149149
// Test Case for readWhile()
150150
//-------------------------------------------------------------------------
151-
151+
152152
suite.add(new YUITest.TestCase({
153-
153+
154154
name : "readWhile() Tests",
155155

156156

157157
//---------------------------------------------------------------------
158158
// Tests
159159
//---------------------------------------------------------------------
160-
160+
161161
/*
162162
* Tests that the entire string can be read..
163163
*/
164164
testReadWhileSimple: function(){
165165
var testString = "Hello world!",
166166
reader = new StringReader(testString);
167-
167+
168168
var result = reader.readWhile(function(){
169169
return true;
170170
});
@@ -173,137 +173,137 @@
173173
Assert.areEqual(1, reader.getLine());
174174
Assert.areEqual(13, reader.getCol());
175175
}
176-
}));
177-
176+
}));
177+
178178
//-------------------------------------------------------------------------
179179
// Test Case for readCount()
180180
//-------------------------------------------------------------------------
181-
181+
182182
suite.add(new YUITest.TestCase({
183-
183+
184184
name : "readCount() Tests",
185185

186186

187187
//---------------------------------------------------------------------
188188
// Tests
189189
//---------------------------------------------------------------------
190-
190+
191191
/*
192192
* Tests that a set number of characters are read correctly.
193193
*/
194194
testReadCountSimple: function(){
195195
var testString = "Hello world!",
196196
reader = new StringReader(testString);
197-
197+
198198
var result = reader.readCount(6);
199199

200200
Assert.areEqual("Hello ", result);
201-
201+
202202
result = reader.readCount(2);
203203
Assert.areEqual("wo", result);
204204
}
205-
}));
206-
205+
}));
206+
207207
//-------------------------------------------------------------------------
208208
// Test Case for readMatch()
209209
//-------------------------------------------------------------------------
210-
210+
211211
suite.add(new YUITest.TestCase({
212-
212+
213213
name : "readMatch() Tests",
214214

215215

216216
//---------------------------------------------------------------------
217217
// Tests
218218
//---------------------------------------------------------------------
219-
219+
220220
/*
221221
* Tests that a text pattern is read correctly.
222222
*/
223223
testReadMatchSimple: function(){
224224
var testString = "Hello world!",
225225
reader = new StringReader(testString);
226-
226+
227227
var result = reader.readMatch("Hello");
228228

229229
Assert.areEqual("Hello", result);
230230
},
231-
231+
232232
/*
233233
* Tests that a regex pattern is read correctly.
234234
*/
235235
testReadMatchRegEx: function(){
236236
var testString = "Hello world!",
237237
reader = new StringReader(testString);
238-
238+
239239
var result = reader.readMatch(/^Hello/);
240240

241241
Assert.areEqual("Hello", result);
242242
}
243-
244-
245-
}));
246-
247-
248-
243+
244+
245+
}));
246+
247+
248+
249249
//-------------------------------------------------------------------------
250250
// Test Case for eof()
251251
//-------------------------------------------------------------------------
252-
252+
253253
suite.add(new YUITest.TestCase({
254-
254+
255255
name : "eof() Tests",
256256

257257

258258
//---------------------------------------------------------------------
259259
// Tests
260260
//---------------------------------------------------------------------
261-
261+
262262
/*
263263
* Tests that eof() works after reading to end of string.
264264
*/
265265
testTestEofSimple: function(){
266266
var testString = "Hello world!",
267267
reader = new StringReader(testString);
268-
268+
269269
reader.readTo("!");
270270
Assert.isTrue(reader.eof());
271-
}
272-
273-
274-
}));
275-
271+
}
272+
273+
274+
}));
275+
276276
//-------------------------------------------------------------------------
277277
// Test Case for mark() and reset()
278278
//-------------------------------------------------------------------------
279-
279+
280280
suite.add(new YUITest.TestCase({
281-
281+
282282
name : "mark() and reset() Tests",
283283

284284

285285
//---------------------------------------------------------------------
286286
// Tests
287287
//---------------------------------------------------------------------
288-
288+
289289
/*
290290
* Tests that mark() and reset() preserve lines/cols correctly.
291291
*/
292292
testMarkResetSimple: function(){
293293
var testString = "Hello world!",
294294
reader = new StringReader(testString);
295-
295+
296296
reader.mark();
297297
reader.readTo("!");
298298
reader.reset();
299-
299+
300300
Assert.areEqual(1, reader.getLine(), "Row should be 1");
301301
Assert.areEqual(1, reader.getCol(), "Column should be 1");
302-
}
303-
304-
305-
}));
306-
302+
}
303+
304+
305+
}));
306+
307307
YUITest.TestRunner.add(suite);
308308

309309
})();

0 commit comments

Comments
 (0)