@@ -19,7 +19,7 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
1919 start: CursorPosition ( line: 2 , character: 0 ) ,
2020 end: CursorPosition ( line: 2 , character: 4 )
2121 )
22- let context = ObjectiveCFocusedCodeFinder ( ) . findFocusedCode (
22+ let context = ObjectiveCFocusedCodeFinder ( maxFocusedCodeLineCount : . max ) . findFocusedCode (
2323 in: document ( code: code) ,
2424 containingRange: range
2525 )
@@ -36,7 +36,7 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
3636 range: . init( startPair: ( 1 , 0 ) , endPair: ( 5 , 1 ) )
3737 ) ,
3838 ] ) ,
39- contextRange: . init( startPair: ( 0 , 0 ) , endPair: ( 6 , 4 ) ) ,
39+ contextRange: . init( startPair: ( 0 , 0 ) , endPair: ( 6 , 4 ) ) ,
4040 smallestContextRange: range,
4141 focusedRange: range,
4242 focusedCode: """
@@ -57,7 +57,7 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
5757 }
5858 """
5959 let range = CursorRange ( startPair: ( 2 , 0 ) , endPair: ( 2 , 4 ) )
60- let context = ObjectiveCFocusedCodeFinder ( ) . findFocusedCode (
60+ let context = ObjectiveCFocusedCodeFinder ( maxFocusedCodeLineCount : . max ) . findFocusedCode (
6161 in: document ( code: code) ,
6262 containingRange: range
6363 )
@@ -80,7 +80,7 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
8080 includes: [ ]
8181 ) )
8282 }
83-
83+
8484 func test_selecting_a_method_inside_an_implementation_the_scope_should_be_the_implementation( ) {
8585 let code = """
8686 __attribute__((objc_nonlazy_class))
@@ -96,7 +96,7 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
9696 start: CursorPosition ( line: 2 , character: 0 ) ,
9797 end: CursorPosition ( line: 6 , character: 1 )
9898 )
99- let context = ObjectiveCFocusedCodeFinder ( ) . findFocusedCode (
99+ let context = ObjectiveCFocusedCodeFinder ( maxFocusedCodeLineCount : . max ) . findFocusedCode (
100100 in: document ( code: code) ,
101101 containingRange: range
102102 )
@@ -117,13 +117,13 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
117117 NSLog(@ " Hello " );
118118 NSLog(@ " World " );
119119 }
120-
120+
121121 """ ,
122122 imports: [ ] ,
123123 includes: [ ]
124124 ) )
125125 }
126-
126+
127127 func test_selecting_a_line_inside_an_interface_the_scope_should_be_the_interface( ) {
128128 let code = """
129129 @interface ViewController <ObjectType: id<UITableViewDelegate, UITableViewDataSource>>: NSObject <ProtocolName>
@@ -136,7 +136,7 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
136136 start: CursorPosition ( line: 1 , character: 0 ) ,
137137 end: CursorPosition ( line: 3 , character: 31 )
138138 )
139- let context = ObjectiveCFocusedCodeFinder ( ) . findFocusedCode (
139+ let context = ObjectiveCFocusedCodeFinder ( maxFocusedCodeLineCount : . max ) . findFocusedCode (
140140 in: document ( code: code) ,
141141 containingRange: range
142142 )
@@ -155,13 +155,13 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
155155 - (void)fooWith:(NSInteger)foo;
156156 - (void)fooWith:(NSInteger)foo;
157157 - (void)fooWith:(NSInteger)foo;
158-
158+
159159 """ ,
160160 imports: [ ] ,
161161 includes: [ ]
162162 ) )
163163 }
164-
164+
165165 func test_selecting_a_line_inside_an_interface_category_the_scope_should_be_the_interface( ) {
166166 let code = """
167167 @interface __GENERICS(NSArray, ObjectType) (BlocksKit)
@@ -174,7 +174,7 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
174174 start: CursorPosition ( line: 1 , character: 0 ) ,
175175 end: CursorPosition ( line: 3 , character: 31 )
176176 )
177- let context = ObjectiveCFocusedCodeFinder ( ) . findFocusedCode (
177+ let context = ObjectiveCFocusedCodeFinder ( maxFocusedCodeLineCount : . max ) . findFocusedCode (
178178 in: document ( code: code) ,
179179 containingRange: range
180180 )
@@ -193,13 +193,13 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
193193 - (void)fooWith:(NSInteger)foo;
194194 - (void)fooWith:(NSInteger)foo;
195195 - (void)fooWith:(NSInteger)foo;
196-
196+
197197 """ ,
198198 imports: [ ] ,
199199 includes: [ ]
200200 ) )
201201 }
202-
202+
203203 func test_selecting_a_line_inside_a_protocol_the_scope_should_be_the_protocol( ) {
204204 let code = """
205205 @protocol Foo<A, B>
@@ -212,7 +212,7 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
212212 start: CursorPosition ( line: 1 , character: 0 ) ,
213213 end: CursorPosition ( line: 3 , character: 31 )
214214 )
215- let context = ObjectiveCFocusedCodeFinder ( ) . findFocusedCode (
215+ let context = ObjectiveCFocusedCodeFinder ( maxFocusedCodeLineCount : . max ) . findFocusedCode (
216216 in: document ( code: code) ,
217217 containingRange: range
218218 )
@@ -231,13 +231,13 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
231231 - (void)fooWith:(NSInteger)foo;
232232 - (void)fooWith:(NSInteger)foo;
233233 - (void)fooWith:(NSInteger)foo;
234-
234+
235235 """ ,
236236 imports: [ ] ,
237237 includes: [ ]
238238 ) )
239239 }
240-
240+
241241 func test_selecting_a_line_inside_a_struct_the_scope_should_be_the_struct( ) {
242242 let code = """
243243 struct Foo {
@@ -250,7 +250,7 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
250250 start: CursorPosition ( line: 1 , character: 0 ) ,
251251 end: CursorPosition ( line: 3 , character: 31 )
252252 )
253- let context = ObjectiveCFocusedCodeFinder ( ) . findFocusedCode (
253+ let context = ObjectiveCFocusedCodeFinder ( maxFocusedCodeLineCount : . max ) . findFocusedCode (
254254 in: document ( code: code) ,
255255 containingRange: range
256256 )
@@ -269,13 +269,13 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
269269 NSInteger foo;
270270 NSInteger bar;
271271 NSInteger baz;
272-
272+
273273 """ ,
274274 imports: [ ] ,
275275 includes: [ ]
276276 ) )
277277 }
278-
278+
279279 func test_selecting_a_line_inside_a_enum_the_scope_should_be_the_enum( ) {
280280 let code = """
281281 enum Foo {
@@ -288,7 +288,7 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
288288 start: CursorPosition ( line: 1 , character: 0 ) ,
289289 end: CursorPosition ( line: 3 , character: 31 )
290290 )
291- let context = ObjectiveCFocusedCodeFinder ( ) . findFocusedCode (
291+ let context = ObjectiveCFocusedCodeFinder ( maxFocusedCodeLineCount : . max ) . findFocusedCode (
292292 in: document ( code: code) ,
293293 containingRange: range
294294 )
@@ -307,13 +307,13 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
307307 foo,
308308 bar,
309309 baz
310-
310+
311311 """ ,
312312 imports: [ ] ,
313313 includes: [ ]
314314 ) )
315315 }
316-
316+
317317 func test_selecting_a_line_inside_an_NSEnum_the_scope_should_be_the_enum( ) {
318318 let code = """
319319 typedef NS_ENUM(NSInteger, Foo) {
@@ -326,7 +326,7 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
326326 start: CursorPosition ( line: 1 , character: 0 ) ,
327327 end: CursorPosition ( line: 3 , character: 31 )
328328 )
329- let context = ObjectiveCFocusedCodeFinder ( ) . findFocusedCode (
329+ let context = ObjectiveCFocusedCodeFinder ( maxFocusedCodeLineCount : . max ) . findFocusedCode (
330330 in: document ( code: code) ,
331331 containingRange: range
332332 )
@@ -345,7 +345,7 @@ final class ObjectiveCFocusedCodeFinder_Selection_Tests: XCTestCase {
345345 foo,
346346 bar,
347347 baz
348-
348+
349349 """ ,
350350 imports: [ ] ,
351351 includes: [ ]
@@ -368,7 +368,7 @@ final class ObjectiveCFocusedCodeFinder_Focus_Tests: XCTestCase {
368368 start: CursorPosition ( line: 2 , character: 0 ) ,
369369 end: CursorPosition ( line: 2 , character: 0 )
370370 )
371- let context = ObjectiveCFocusedCodeFinder ( ) . findFocusedCode (
371+ let context = ObjectiveCFocusedCodeFinder ( maxFocusedCodeLineCount : . max ) . findFocusedCode (
372372 in: document ( code: code) ,
373373 containingRange: range
374374 )
@@ -381,52 +381,53 @@ final class ObjectiveCFocusedCodeFinder_Focus_Tests: XCTestCase {
381381 ) ,
382382 ] ) ,
383383 contextRange: . init( startPair: ( 0 , 0 ) , endPair: ( 6 , 4 ) ) ,
384- smallestContextRange: range ,
384+ smallestContextRange: . init ( startPair : ( 1 , 0 ) , endPair : ( 5 , 1 ) ) ,
385385 focusedRange: . init( startPair: ( 1 , 0 ) , endPair: ( 5 , 1 ) ) ,
386386 focusedCode: """
387387 - (void)fooWith:(NSInteger)foo {
388388 NSInteger foo = 0;
389389 NSLog(@ " Hello " );
390390 NSLog(@ " World " );
391391 }
392-
392+
393393 """ ,
394394 imports: [ ] ,
395395 includes: [ ]
396396 ) )
397397 }
398-
399- func test_get_focused_code_inside_an_interface_category_the_focused_code_should_be_the_interface( ) {
398+
399+ func test_get_focused_code_inside_an_interface_category_the_focused_code_should_be_the_interface(
400+ ) {
400401 let code = """
401402 @interface __GENERICS(NSArray, ObjectType) (BlocksKit)
402403 - (void)fooWith:(NSInteger)foo;
403404 - (void)fooWith:(NSInteger)foo;
404405 - (void)fooWith:(NSInteger)foo;
405406 @end
406-
407+
407408 @implementation Foo
408409 @end
409410 """
410411 let range = CursorRange (
411412 start: CursorPosition ( line: 1 , character: 0 ) ,
412413 end: CursorPosition ( line: 1 , character: 0 )
413414 )
414- let context = ObjectiveCFocusedCodeFinder ( ) . findFocusedCode (
415+ let context = ObjectiveCFocusedCodeFinder ( maxFocusedCodeLineCount : . max ) . findFocusedCode (
415416 in: document ( code: code) ,
416417 containingRange: range
417418 )
418419 XCTAssertEqual ( context, . init(
419420 scope: . file,
420421 contextRange: . init( startPair: ( 0 , 0 ) , endPair: ( 0 , 0 ) ) ,
421- smallestContextRange: range ,
422+ smallestContextRange: . init ( startPair : ( 0 , 0 ) , endPair : ( 4 , 4 ) ) ,
422423 focusedRange: . init( startPair: ( 0 , 0 ) , endPair: ( 4 , 4 ) ) ,
423424 focusedCode: """
424425 @interface __GENERICS(NSArray, ObjectType) (BlocksKit)
425426 - (void)fooWith:(NSInteger)foo;
426427 - (void)fooWith:(NSInteger)foo;
427428 - (void)fooWith:(NSInteger)foo;
428429 @end
429-
430+
430431 """ ,
431432 imports: [ ] ,
432433 includes: [ ]
@@ -442,19 +443,20 @@ final class ObjectiveCFocusedCodeFinder_Imports_Tests: XCTestCase {
442443 #import " Foo.h "
443444 #include " Bar.h "
444445 """
445-
446- let context = ObjectiveCFocusedCodeFinder ( ) . findFocusedCode (
446+
447+ let context = ObjectiveCFocusedCodeFinder ( maxFocusedCodeLineCount : . max ) . findFocusedCode (
447448 in: document ( code: code) ,
448449 containingRange: . zero
449450 )
450-
451+
451452 XCTAssertEqual ( context. imports, [
452453 " <Foundation/Foundation.h> " ,
453454 " UIKit " ,
454- " \" Foo.h \" "
455+ " \" Foo.h \" " ,
455456 ] )
456457 XCTAssertEqual ( context. includes, [
457- " \" Bar.h \" "
458+ " \" Bar.h \" " ,
458459 ] )
459460 }
460461}
462+
0 commit comments