Commit d66c7dd 1 parent 9665782 commit d66c7dd Copy full SHA for d66c7dd
File tree 1 file changed +39
-14
lines changed
1 file changed +39
-14
lines changed Original file line number Diff line number Diff line change @@ -13,19 +13,44 @@ test('trimLines(value)', function (t) {
13
13
} )
14
14
15
15
test ( 'efficiency' , ( t ) => {
16
- const aTonOfWhitespace = 'a' + ' ' . repeat ( 70_000 ) + 'b'
17
- const timeoutId = setTimeout ( ( ) => {
18
- t . fail ( 'should process lots of whitespace efficiently' )
19
- } , 10 )
20
-
21
- t . deepEqual (
22
- trimLines ( aTonOfWhitespace ) ,
23
- aTonOfWhitespace ,
24
- 'should be efficient on excessive whitespace'
25
- )
16
+ const whitespace = ' ' . repeat ( 70_000 )
17
+
18
+ t . test ( 'whitespace in line' , ( t ) => {
19
+ const timeoutId = setTimeout ( ( ) => {
20
+ t . fail ( 'did not pass in 10ms' )
21
+ } , 10 )
22
+
23
+ t . deepEqual ( trimLines ( 'a' + whitespace + 'b' ) , 'a' + whitespace + 'b' )
24
+
25
+ setTimeout ( ( ) => {
26
+ clearTimeout ( timeoutId )
27
+ t . end ( )
28
+ } , 0 )
29
+ } )
30
+
31
+ t . test ( 'whitespace around line' , ( t ) => {
32
+ const timeoutId = setTimeout ( ( ) => {
33
+ t . fail ( 'did not pass in 10ms' )
34
+ } , 10 )
35
+
36
+ t . deepEqual (
37
+ trimLines (
38
+ 'a' +
39
+ whitespace +
40
+ '\n' +
41
+ whitespace +
42
+ 'b' +
43
+ whitespace +
44
+ '\n' +
45
+ whitespace +
46
+ 'c'
47
+ ) ,
48
+ 'a\nb\nc'
49
+ )
26
50
27
- setTimeout ( ( ) => {
28
- clearTimeout ( timeoutId )
29
- t . end ( )
30
- } , 0 )
51
+ setTimeout ( ( ) => {
52
+ clearTimeout ( timeoutId )
53
+ t . end ( )
54
+ } , 0 )
55
+ } )
31
56
} )
You can’t perform that action at this time.
0 commit comments