Skip to content

Commit a549d20

Browse files
committed
Fix tests
1 parent eb52204 commit a549d20

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

test/rbs/inline_annotation_parsing_test.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,6 @@ def test_error__instance_variable
226226
Parser.parse_inline_leading_annotation("@rbs @name:", 0...)
227227
end
228228

229-
assert_raises RBS::ParsingError do
230-
Parser.parse_inline_leading_annotation("@rbs name: String", 0...)
231-
end
232-
233229
assert_raises RBS::ParsingError do
234230
Parser.parse_inline_leading_annotation("@rbs @name: void", 0...)
235231
end

test/rbs/inline_parser_test.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -767,25 +767,22 @@ class Foo
767767
end
768768
RUBY
769769

770-
# The @rbs annotations should be reported as syntax errors (invalid format)
770+
# The @rbs annotations should be reported as unused (ParamTypeAnnotation is valid but not applicable to attr_*)
771771
assert_equal 3, result.diagnostics.size
772772

773773
assert_any!(result.diagnostics) do |diagnostic|
774-
assert_instance_of RBS::InlineParser::Diagnostic::AnnotationSyntaxError, diagnostic
774+
assert_instance_of RBS::InlineParser::Diagnostic::UnusedInlineAnnotation, diagnostic
775775
assert_equal "@rbs name: String", diagnostic.location.source
776-
assert_match(/Syntax error:/, diagnostic.message)
777776
end
778777

779778
assert_any!(result.diagnostics) do |diagnostic|
780-
assert_instance_of RBS::InlineParser::Diagnostic::AnnotationSyntaxError, diagnostic
779+
assert_instance_of RBS::InlineParser::Diagnostic::UnusedInlineAnnotation, diagnostic
781780
assert_equal "@rbs age: Integer", diagnostic.location.source
782-
assert_match(/Syntax error:/, diagnostic.message)
783781
end
784782

785783
assert_any!(result.diagnostics) do |diagnostic|
786-
assert_instance_of RBS::InlineParser::Diagnostic::AnnotationSyntaxError, diagnostic
784+
assert_instance_of RBS::InlineParser::Diagnostic::UnusedInlineAnnotation, diagnostic
787785
assert_equal "@rbs data: Array[Hash[Symbol, untyped]]", diagnostic.location.source
788-
assert_match(/Syntax error:/, diagnostic.message)
789786
end
790787

791788
result.declarations[0].tap do |decl|

0 commit comments

Comments
 (0)