33require "test_helper"
44
55class RBS ::Inline ::AnnotationParserTest < Minitest ::Test
6+ include RBS
67 include RBS ::Inline
78
89 def parse_comments ( src )
@@ -289,11 +290,11 @@ def test_inherits
289290 RUBY
290291
291292 annots [ 0 ] . annotations [ 0 ] . tap do |annotation |
292- assert_equal TypeName ( "Object" ) , annotation . super_name
293+ assert_equal TypeName . parse ( "Object" ) , annotation . super_name
293294 assert_equal [ ] , annotation . args . map ( &:to_s )
294295 end
295296 annots [ 0 ] . annotations [ 1 ] . tap do |annotation |
296- assert_equal TypeName ( "Array" ) , annotation . super_name
297+ assert_equal TypeName . parse ( "Array" ) , annotation . super_name
297298 assert_equal [ "String" ] , annotation . args . map ( &:to_s )
298299 end
299300 annots [ 0 ] . annotations [ 2 ] . tap do |annotation |
@@ -338,39 +339,39 @@ def test_use
338339 assert_instance_of AST ::Annotations ::Use , annotation
339340
340341 annotation . clauses [ 0 ] . tap do |clause |
341- assert_equal TypeName ( "::Foo" ) , clause . type_name
342+ assert_equal TypeName . parse ( "::Foo" ) , clause . type_name
342343 assert_nil clause . new_name
343344 end
344345 end
345346 annots [ 0 ] . annotations [ 1 ] . tap do |annotation |
346347 assert_instance_of AST ::Annotations ::Use , annotation
347348
348349 annotation . clauses [ 0 ] . tap do |clause |
349- assert_equal TypeName ( "Foo" ) , clause . type_name
350+ assert_equal TypeName . parse ( "Foo" ) , clause . type_name
350351 assert_nil clause . new_name
351352 end
352353 end
353354 annots [ 0 ] . annotations [ 2 ] . tap do |annotation |
354355 assert_instance_of AST ::Annotations ::Use , annotation
355356
356357 annotation . clauses [ 0 ] . tap do |clause |
357- assert_equal TypeName ( "Foo::Bar" ) , clause . type_name
358+ assert_equal TypeName . parse ( "Foo::Bar" ) , clause . type_name
358359 assert_nil clause . new_name
359360 end
360361 end
361362 annots [ 0 ] . annotations [ 3 ] . tap do |annotation |
362363 assert_instance_of AST ::Annotations ::Use , annotation
363364
364365 annotation . clauses [ 0 ] . tap do |clause |
365- assert_equal TypeName ( "Foo::bar" ) , clause . type_name
366+ assert_equal TypeName . parse ( "Foo::bar" ) , clause . type_name
366367 assert_nil clause . new_name
367368 end
368369 end
369370 annots [ 0 ] . annotations [ 4 ] . tap do |annotation |
370371 assert_instance_of AST ::Annotations ::Use , annotation
371372
372373 annotation . clauses [ 0 ] . tap do |clause |
373- assert_equal TypeName ( "Foo::_Bar" ) , clause . type_name
374+ assert_equal TypeName . parse ( "Foo::_Bar" ) , clause . type_name
374375 assert_nil clause . new_name
375376 end
376377 end
@@ -385,15 +386,15 @@ def test_use
385386 assert_instance_of AST ::Annotations ::Use , annotation
386387
387388 annotation . clauses [ 0 ] . tap do |clause |
388- assert_equal TypeName ( "Foo::Bar" ) , clause . type_name
389+ assert_equal TypeName . parse ( "Foo::Bar" ) , clause . type_name
389390 assert_equal :Bar2 , clause . new_name
390391 end
391392 annotation . clauses [ 1 ] . tap do |clause |
392- assert_equal TypeName ( "Foo::bar" ) , clause . type_name
393+ assert_equal TypeName . parse ( "Foo::bar" ) , clause . type_name
393394 assert_equal :bar2 , clause . new_name
394395 end
395396 annotation . clauses [ 2 ] . tap do |clause |
396- assert_equal TypeName ( "Foo::_Bar" ) , clause . type_name
397+ assert_equal TypeName . parse ( "Foo::_Bar" ) , clause . type_name
397398 assert_equal :_Bar2 , clause . new_name
398399 end
399400 end
@@ -663,29 +664,29 @@ def test_module_decl_annotation
663664
664665 annots [ 0 ] . annotations [ 0 ] . tap do |annotation |
665666 assert_instance_of AST ::Annotations ::ModuleDecl , annotation
666- assert_equal TypeName ( "Foo" ) , annotation . name
667+ assert_equal TypeName . parse ( "Foo" ) , annotation . name
667668 assert_empty annotation . type_params
668669 assert_empty annotation . self_types
669670 end
670671 annots [ 0 ] . annotations [ 1 ] . tap do |annotation |
671672 assert_instance_of AST ::Annotations ::ModuleDecl , annotation
672- assert_equal TypeName ( "::Foo::Bar" ) , annotation . name
673+ assert_equal TypeName . parse ( "::Foo::Bar" ) , annotation . name
673674 assert_empty annotation . type_params
674675 assert_empty annotation . self_types
675676 end
676677 annots [ 0 ] . annotations [ 2 ] . tap do |annotation |
677678 assert_instance_of AST ::Annotations ::ModuleDecl , annotation
678- assert_equal TypeName ( "Foo" ) , annotation . name
679+ assert_equal TypeName . parse ( "Foo" ) , annotation . name
679680 annotation . type_params [ 0 ] . tap do |param |
680681 assert_equal :A , param . name
681682 assert_equal "Integer" , param . upper_bound . to_s
682683 end
683684 annotation . self_types [ 0 ] . tap do |self_type |
684- assert_equal TypeName ( "BasicObject" ) , self_type . name
685+ assert_equal TypeName . parse ( "BasicObject" ) , self_type . name
685686 assert_empty self_type . args
686687 end
687688 annotation . self_types [ 1 ] . tap do |self_type |
688- assert_equal TypeName ( "_Each" ) , self_type . name
689+ assert_equal TypeName . parse ( "_Each" ) , self_type . name
689690 assert_equal [ "String" ] , self_type . args . map ( &:to_s )
690691 end
691692 end
@@ -705,18 +706,18 @@ def test_class_decl_annotation
705706
706707 annots [ 0 ] . annotations [ 0 ] . tap do |annotation |
707708 assert_instance_of AST ::Annotations ::ClassDecl , annotation
708- assert_equal TypeName ( "Foo" ) , annotation . name
709+ assert_equal TypeName . parse ( "Foo" ) , annotation . name
709710 assert_empty annotation . type_params
710711 assert_nil annotation . super_class
711712 end
712713 annots [ 0 ] . annotations [ 1 ] . tap do |annotation |
713714 assert_instance_of AST ::Annotations ::ClassDecl , annotation
714- assert_equal TypeName ( "Foo" ) , annotation . name
715+ assert_equal TypeName . parse ( "Foo" ) , annotation . name
715716 annotation . type_params [ 0 ] . tap do |param |
716717 assert_equal :A , param . name
717718 assert_equal "Integer" , param . upper_bound . to_s
718719 end
719- assert_equal TypeName ( "Array" ) , annotation . super_class . name
720+ assert_equal TypeName . parse ( "Array" ) , annotation . super_class . name
720721 assert_equal [ "A" ] , annotation . super_class . args . map ( &:to_s )
721722 end
722723 end
0 commit comments