Class: RubyIndexer::ClassesAndModulesTest

Inherits:
TestCase
  • Object
show all
Defined in:
lib/ruby_indexer/test/classes_and_modules_test.rb

Instance Method Summary collapse

Methods inherited from TestCase

#setup

Instance Method Details

#test_class_with_statementsObject



26
27
28
29
30
31
32
33
34
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 26

def test_class_with_statements
  index("    class Foo\n      def something; end\n    end\n  RUBY\n\n  assert_entry(\"Foo\", Entry::Class, \"/fake/path/foo.rb:0-0:2-3\")\nend\n")

#test_colon_colon_classObject



36
37
38
39
40
41
42
43
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 36

def test_colon_colon_class
  index("    class ::Foo\n    end\n  RUBY\n\n  assert_entry(\"Foo\", Entry::Class, \"/fake/path/foo.rb:0-0:1-3\")\nend\n")

#test_colon_colon_class_inside_classObject



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 45

def test_colon_colon_class_inside_class
  index("    class Bar\n      class ::Foo\n      end\n    end\n  RUBY\n\n  assert_entry(\"Bar\", Entry::Class, \"/fake/path/foo.rb:0-0:3-3\")\n  assert_entry(\"Foo\", Entry::Class, \"/fake/path/foo.rb:1-2:2-5\")\nend\n")

#test_colon_colon_moduleObject



119
120
121
122
123
124
125
126
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 119

def test_colon_colon_module
  index("    module ::Foo\n    end\n  RUBY\n\n  assert_entry(\"Foo\", Entry::Module, \"/fake/path/foo.rb:0-0:1-3\")\nend\n")

#test_comments_can_be_attached_to_a_classObject



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 198

def test_comments_can_be_attached_to_a_class
  index("    # This is method comment\n    def foo; end\n    # This is a Foo comment\n    # This is another Foo comment\n    class Foo\n      # This should not be attached\n    end\n\n    # Ignore me\n\n    # This Bar comment has 1 line padding\n\n    class Bar; end\n  RUBY\n\n  foo_entry = @index[\"Foo\"].first\n  assert_equal(\"This is a Foo comment\\nThis is another Foo comment\", foo_entry.comments.join(\"\\n\"))\n\n  bar_entry = @index[\"Bar\"].first\n  assert_equal(\"This Bar comment has 1 line padding\", bar_entry.comments.join(\"\\n\"))\nend\n")

#test_comments_can_be_attached_to_a_namespaced_classObject



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 231

def test_comments_can_be_attached_to_a_namespaced_class
  index("    # This is a Foo comment\n    # This is another Foo comment\n    class Foo\n      # This is a Bar comment\n      class Bar; end\n    end\n  RUBY\n\n  foo_entry = @index[\"Foo\"].first\n  assert_equal(\"This is a Foo comment\\nThis is another Foo comment\", foo_entry.comments.join(\"\\n\"))\n\n  bar_entry = @index[\"Foo::Bar\"].first\n  assert_equal(\"This is a Bar comment\", bar_entry.comments.join(\"\\n\"))\nend\n")

#test_comments_can_be_attached_to_a_reopened_classObject



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 248

def test_comments_can_be_attached_to_a_reopened_class
  index("    # This is a Foo comment\n    class Foo; end\n\n    # This is another Foo comment\n    class Foo; end\n  RUBY\n\n  first_foo_entry = @index[\"Foo\"][0]\n  assert_equal(\"This is a Foo comment\", first_foo_entry.comments.join(\"\\n\"))\n\n  second_foo_entry = @index[\"Foo\"][1]\n  assert_equal(\"This is another Foo comment\", second_foo_entry.comments.join(\"\\n\"))\nend\n")

#test_comments_removes_the_leading_pound_and_spaceObject



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 264

def test_comments_removes_the_leading_pound_and_space
  index("    # This is a Foo comment\n    class Foo; end\n\n    #This is a Bar comment\n    class Bar; end\n  RUBY\n\n  first_foo_entry = @index[\"Foo\"][0]\n  assert_equal(\"This is a Foo comment\", first_foo_entry.comments.join(\"\\n\"))\n\n  second_foo_entry = @index[\"Bar\"][0]\n  assert_equal(\"This is a Bar comment\", second_foo_entry.comments.join(\"\\n\"))\nend\n")

#test_conditional_classObject



17
18
19
20
21
22
23
24
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 17

def test_conditional_class
  index("    class Foo\n    end if condition\n  RUBY\n\n  assert_entry(\"Foo\", Entry::Class, \"/fake/path/foo.rb:0-0:1-3\")\nend\n")

#test_conditional_moduleObject



100
101
102
103
104
105
106
107
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 100

def test_conditional_module
  index("    module Foo\n    end if condition\n  RUBY\n\n  assert_entry(\"Foo\", Entry::Module, \"/fake/path/foo.rb:0-0:1-3\")\nend\n")

#test_deleting_from_index_based_on_file_pathObject



184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 184

def test_deleting_from_index_based_on_file_path
  index("    class Foo\n    end\n  RUBY\n\n  assert_entry(\"Foo\", Entry::Class, \"/fake/path/foo.rb:0-0:1-3\")\n\n  @index.delete(IndexablePath.new(nil, \"/fake/path/foo.rb\"))\n  refute_entry(\"Foo\")\n\n  assert_no_indexed_entries\nend\n")

#test_dynamic_singleton_class_blocksObject



489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 489

def test_dynamic_singleton_class_blocks
  index("    class Foo\n      # Some extra comments\n      class << bar\n      end\n    end\n  RUBY\n\n  singleton = T.must(@index[\"Foo::<Class:bar>\"].first)\n\n  # Even though this is not correct, we consider any dynamic singleton class block as a regular singleton class.\n  # That pattern cannot be properly analyzed statically and assuming that it's always a regular singleton simplifies\n  # the implementation considerably.\n  assert_equal(3, singleton.location.start_line)\n  assert_equal(\"Some extra comments\", singleton.comments.join(\"\\n\"))\nend\n")

#test_dynamically_namespaced_classObject



66
67
68
69
70
71
72
73
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 66

def test_dynamically_namespaced_class
  index("    class self::Bar\n    end\n  RUBY\n\n  assert_entry(\"self::Bar\", Entry::Class, \"/fake/path/foo.rb:0-0:1-3\")\nend\n")

#test_dynamically_namespaced_class_doesnt_affect_other_classesObject



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 75

def test_dynamically_namespaced_class_doesnt_affect_other_classes
  index("    class Foo\n      class self::Bar\n      end\n\n      class Bar\n      end\n    end\n  RUBY\n\n  refute_entry(\"self::Bar\")\n  assert_entry(\"Foo\", Entry::Class, \"/fake/path/foo.rb:0-0:6-3\")\n  assert_entry(\"Foo::Bar\", Entry::Class, \"/fake/path/foo.rb:4-2:5-5\")\nend\n")

#test_dynamically_namespaced_moduleObject



137
138
139
140
141
142
143
144
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 137

def test_dynamically_namespaced_module
  index("    module self::Bar\n    end\n  RUBY\n\n  assert_entry(\"self::Bar\", Entry::Module, \"/fake/path/foo.rb:0-0:1-3\")\nend\n")

#test_dynamically_namespaced_module_doesnt_affect_other_modulesObject



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 146

def test_dynamically_namespaced_module_doesnt_affect_other_modules
  index("    module Foo\n      class self::Bar\n      end\n\n      module Bar\n      end\n    end\n  RUBY\n\n  assert_entry(\"Foo::self::Bar\", Entry::Class, \"/fake/path/foo.rb:1-2:2-5\")\n  assert_entry(\"Foo\", Entry::Module, \"/fake/path/foo.rb:0-0:6-3\")\n  assert_entry(\"Foo::Bar\", Entry::Module, \"/fake/path/foo.rb:4-2:5-5\")\nend\n")

#test_empty_statements_classObject



8
9
10
11
12
13
14
15
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 8

def test_empty_statements_class
  index("    class Foo\n    end\n  RUBY\n\n  assert_entry(\"Foo\", Entry::Class, \"/fake/path/foo.rb:0-0:1-3\")\nend\n")

#test_empty_statements_moduleObject



91
92
93
94
95
96
97
98
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 91

def test_empty_statements_module
  index("    module Foo\n    end\n  RUBY\n\n  assert_entry(\"Foo\", Entry::Module, \"/fake/path/foo.rb:0-0:1-3\")\nend\n")

#test_indexing_namespaces_inside_nested_top_level_referencesObject



588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 588

def test_indexing_namespaces_inside_nested_top_level_references
  index("    class Baz\n      module ::Foo\n        class Bar\n        end\n\n        class ::Qux\n        end\n      end\n    end\n  RUBY\n\n  refute_entry(\"Baz::Foo\")\n  refute_entry(\"Baz::Foo::Bar\")\n  assert_entry(\"Baz\", Entry::Class, \"/fake/path/foo.rb:0-0:8-3\")\n  assert_entry(\"Foo\", Entry::Module, \"/fake/path/foo.rb:1-2:7-5\")\n  assert_entry(\"Foo::Bar\", Entry::Class, \"/fake/path/foo.rb:2-4:3-7\")\n  assert_entry(\"Qux\", Entry::Class, \"/fake/path/foo.rb:5-4:6-7\")\nend\n")

#test_indexing_namespaces_inside_top_level_referencesObject



550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 550

def test_indexing_namespaces_inside_top_level_references
  index("    module ::Foo\n      class Bar\n      end\n    end\n  RUBY\n\n  # We want to explicitly verify that we didn't introduce the leading `::` by accident, but `Index#[]` deletes the\n  # prefix when we use `refute_entry`\n  entries = @index.instance_variable_get(:@entries)\n  refute(entries.key?(\"::Foo\"))\n  refute(entries.key?(\"::Foo::Bar\"))\n  assert_entry(\"Foo\", Entry::Module, \"/fake/path/foo.rb:0-0:3-3\")\n  assert_entry(\"Foo::Bar\", Entry::Class, \"/fake/path/foo.rb:1-2:2-5\")\nend\n")

#test_indexing_singletons_inside_top_level_referencesObject



567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 567

def test_indexing_singletons_inside_top_level_references
  index("    module ::Foo\n      class Bar\n        class << self\n        end\n      end\n    end\n  RUBY\n\n  # We want to explicitly verify that we didn't introduce the leading `::` by accident, but `Index#[]` deletes the\n  # prefix when we use `refute_entry`\n  entries = @index.instance_variable_get(:@entries)\n  refute(entries.key?(\"::Foo\"))\n  refute(entries.key?(\"::Foo::Bar\"))\n  refute(entries.key?(\"::Foo::Bar::<Class:Bar>\"))\n  assert_entry(\"Foo\", Entry::Module, \"/fake/path/foo.rb:0-0:5-3\")\n  assert_entry(\"Foo::Bar\", Entry::Class, \"/fake/path/foo.rb:1-2:4-5\")\n  assert_entry(\"Foo::Bar::<Class:Bar>\", Entry::SingletonClass, \"/fake/path/foo.rb:2-4:3-7\")\nend\n")

#test_keeping_track_of_extended_modulesObject



428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 428

def test_keeping_track_of_extended_modules
  index("    class Foo\n      # valid syntaxes that we can index\n      extend A1\n      self.extend A2\n      extend A3, A4\n      self.extend A5, A6\n\n      # valid syntaxes that we cannot index because of their dynamic nature\n      extend some_variable_or_method_call\n      self.extend some_variable_or_method_call\n\n      def something\n        extend A7 # We should not index this because of this dynamic nature\n      end\n\n      # Valid inner class syntax definition with its own modules prepended\n      class Qux\n        extend Corge\n        self.extend Corge\n        extend Baz\n\n        extend some_variable_or_method_call\n      end\n    end\n\n    class ConstantPathReferences\n      extend Foo::Bar\n      self.extend Foo::Bar2\n\n      extend dynamic::Bar\n      extend Foo::\n    end\n  RUBY\n\n  foo = T.must(@index[\"Foo::<Class:Foo>\"][0])\n  assert_equal([\"A1\", \"A2\", \"A3\", \"A4\", \"A5\", \"A6\"], foo.mixin_operation_module_names)\n\n  qux = T.must(@index[\"Foo::Qux::<Class:Qux>\"][0])\n  assert_equal([\"Corge\", \"Corge\", \"Baz\"], qux.mixin_operation_module_names)\n\n  constant_path_references = T.must(@index[\"ConstantPathReferences::<Class:ConstantPathReferences>\"][0])\n  assert_equal([\"Foo::Bar\", \"Foo::Bar2\"], constant_path_references.mixin_operation_module_names)\nend\n")

#test_keeping_track_of_included_modulesObject



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 336

def test_keeping_track_of_included_modules
  index("    class Foo\n      # valid syntaxes that we can index\n      include A1\n      self.include A2\n      include A3, A4\n      self.include A5, A6\n\n      # valid syntaxes that we cannot index because of their dynamic nature\n      include some_variable_or_method_call\n      self.include some_variable_or_method_call\n\n      def something\n        include A7 # We should not index this because of this dynamic nature\n      end\n\n      # Valid inner class syntax definition with its own modules included\n      class Qux\n        include Corge\n        self.include Corge\n        include Baz\n\n        include some_variable_or_method_call\n      end\n    end\n\n    class ConstantPathReferences\n      include Foo::Bar\n      self.include Foo::Bar2\n\n      include dynamic::Bar\n      include Foo::\n    end\n  RUBY\n\n  foo = T.must(@index[\"Foo\"][0])\n  assert_equal([\"A1\", \"A2\", \"A3\", \"A4\", \"A5\", \"A6\"], foo.mixin_operation_module_names)\n\n  qux = T.must(@index[\"Foo::Qux\"][0])\n  assert_equal([\"Corge\", \"Corge\", \"Baz\"], qux.mixin_operation_module_names)\n\n  constant_path_references = T.must(@index[\"ConstantPathReferences\"][0])\n  assert_equal([\"Foo::Bar\", \"Foo::Bar2\"], constant_path_references.mixin_operation_module_names)\nend\n")

#test_keeping_track_of_prepended_modulesObject



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 382

def test_keeping_track_of_prepended_modules
  index("    class Foo\n      # valid syntaxes that we can index\n      prepend A1\n      self.prepend A2\n      prepend A3, A4\n      self.prepend A5, A6\n\n      # valid syntaxes that we cannot index because of their dynamic nature\n      prepend some_variable_or_method_call\n      self.prepend some_variable_or_method_call\n\n      def something\n        prepend A7 # We should not index this because of this dynamic nature\n      end\n\n      # Valid inner class syntax definition with its own modules prepended\n      class Qux\n        prepend Corge\n        self.prepend Corge\n        prepend Baz\n\n        prepend some_variable_or_method_call\n      end\n    end\n\n    class ConstantPathReferences\n      prepend Foo::Bar\n      self.prepend Foo::Bar2\n\n      prepend dynamic::Bar\n      prepend Foo::\n    end\n  RUBY\n\n  foo = T.must(@index[\"Foo\"][0])\n  assert_equal([\"A1\", \"A2\", \"A3\", \"A4\", \"A5\", \"A6\"], foo.mixin_operation_module_names)\n\n  qux = T.must(@index[\"Foo::Qux\"][0])\n  assert_equal([\"Corge\", \"Corge\", \"Baz\"], qux.mixin_operation_module_names)\n\n  constant_path_references = T.must(@index[\"ConstantPathReferences\"][0])\n  assert_equal([\"Foo::Bar\", \"Foo::Bar2\"], constant_path_references.mixin_operation_module_names)\nend\n")

#test_keeping_track_of_super_classesObject



303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 303

def test_keeping_track_of_super_classes
  index("    class Foo < Bar\n    end\n\n    class Baz\n    end\n\n    module Something\n      class Baz\n      end\n\n      class Qux < ::Baz\n      end\n    end\n\n    class FinalThing < Something::Baz\n    end\n  RUBY\n\n  foo = T.must(@index[\"Foo\"].first)\n  assert_equal(\"Bar\", foo.parent_class)\n\n  baz = T.must(@index[\"Baz\"].first)\n  assert_equal(\"::Object\", baz.parent_class)\n\n  qux = T.must(@index[\"Something::Qux\"].first)\n  assert_equal(\"::Baz\", qux.parent_class)\n\n  final_thing = T.must(@index[\"FinalThing\"].first)\n  assert_equal(\"Something::Baz\", final_thing.parent_class)\nend\n")

#test_module_with_statementsObject



109
110
111
112
113
114
115
116
117
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 109

def test_module_with_statements
  index("    module Foo\n      def something; end\n    end\n  RUBY\n\n  assert_entry(\"Foo\", Entry::Module, \"/fake/path/foo.rb:0-0:2-3\")\nend\n")

#test_name_location_points_to_constant_path_locationObject



520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 520

def test_name_location_points_to_constant_path_location
  index("    class Foo\n      def foo; end\n    end\n\n    module Bar\n      def bar; end\n    end\n  RUBY\n\n  foo = T.must(@index[\"Foo\"].first)\n  refute_equal(foo.location, foo.name_location)\n\n  name_location = foo.name_location\n  assert_equal(1, name_location.start_line)\n  assert_equal(1, name_location.end_line)\n  assert_equal(6, name_location.start_column)\n  assert_equal(9, name_location.end_column)\n\n  bar = T.must(@index[\"Bar\"].first)\n  refute_equal(bar.location, bar.name_location)\n\n  name_location = bar.name_location\n  assert_equal(5, name_location.start_line)\n  assert_equal(5, name_location.end_line)\n  assert_equal(7, name_location.start_column)\n  assert_equal(10, name_location.end_column)\nend\n")

#test_namespaced_classObject



57
58
59
60
61
62
63
64
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 57

def test_namespaced_class
  index("    class Foo::Bar\n    end\n  RUBY\n\n  assert_entry(\"Foo::Bar\", Entry::Class, \"/fake/path/foo.rb:0-0:1-3\")\nend\n")

#test_namespaced_moduleObject



128
129
130
131
132
133
134
135
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 128

def test_namespaced_module
  index("    module Foo::Bar\n    end\n  RUBY\n\n  assert_entry(\"Foo::Bar\", Entry::Module, \"/fake/path/foo.rb:0-0:1-3\")\nend\n")

#test_namespaces_inside_singleton_blocksObject



507
508
509
510
511
512
513
514
515
516
517
518
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 507

def test_namespaces_inside_singleton_blocks
  index("    class Foo\n      class << self\n        class Bar\n        end\n      end\n    end\n  RUBY\n\n  assert_entry(\"Foo::<Class:Foo>::Bar\", Entry::Class, \"/fake/path/foo.rb:2-4:3-7\")\nend\n")

#test_nested_modules_and_classesObject



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 162

def test_nested_modules_and_classes
  index("    module Foo\n      class Bar\n      end\n\n      module Baz\n        class Qux\n          class Something\n          end\n        end\n      end\n    end\n  RUBY\n\n  assert_entry(\"Foo\", Entry::Module, \"/fake/path/foo.rb:0-0:10-3\")\n  assert_entry(\"Foo::Bar\", Entry::Class, \"/fake/path/foo.rb:1-2:2-5\")\n  assert_entry(\"Foo::Baz\", Entry::Module, \"/fake/path/foo.rb:4-2:9-5\")\n  assert_entry(\"Foo::Baz::Qux\", Entry::Class, \"/fake/path/foo.rb:5-4:8-7\")\n  assert_entry(\"Foo::Baz::Qux::Something\", Entry::Class, \"/fake/path/foo.rb:6-6:7-9\")\nend\n")

#test_private_class_and_module_indexingObject



280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 280

def test_private_class_and_module_indexing
  index("    class A\n      class B; end\n      private_constant(:B)\n\n      module C; end\n      private_constant(\"C\")\n\n      class D; end\n    end\n  RUBY\n\n  b_const = @index[\"A::B\"].first\n  assert_equal(Entry::Visibility::PRIVATE, b_const.visibility)\n\n  c_const = @index[\"A::C\"].first\n  assert_equal(Entry::Visibility::PRIVATE, c_const.visibility)\n\n  d_const = @index[\"A::D\"].first\n  assert_equal(Entry::Visibility::PUBLIC, d_const.visibility)\nend\n")

#test_skips_comments_containing_invalid_encodingsObject



222
223
224
225
226
227
228
229
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 222

def test_skips_comments_containing_invalid_encodings
  index("    # comment \\xBA\n    class Foo\n    end\n  RUBY\n  assert(@index[\"Foo\"].first)\nend\n")

#test_tracking_singleton_classesObject



474
475
476
477
478
479
480
481
482
483
484
485
486
487
# File 'lib/ruby_indexer/test/classes_and_modules_test.rb', line 474

def test_tracking_singleton_classes
  index("    class Foo; end\n    class Foo\n      # Some extra comments\n      class << self\n      end\n    end\n  RUBY\n\n  foo = T.must(@index[\"Foo::<Class:Foo>\"].first)\n  assert_equal(4, foo.location.start_line)\n  assert_equal(\"Some extra comments\", foo.comments.join(\"\\n\"))\nend\n")