mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Use issue expectation helpers in Lint::Syntax
rule spec
This commit is contained in:
parent
c89d32fcf6
commit
c58d4cc65a
1 changed files with 5 additions and 6 deletions
|
@ -5,23 +5,22 @@ module Ameba::Rule::Lint
|
||||||
subject = Syntax.new
|
subject = Syntax.new
|
||||||
|
|
||||||
it "passes if there is no invalid syntax" do
|
it "passes if there is no invalid syntax" do
|
||||||
s = Source.new %(
|
expect_no_issues subject, <<-CRYSTAL
|
||||||
def hello
|
def hello
|
||||||
puts "totally valid"
|
puts "totally valid"
|
||||||
rescue e: Exception
|
rescue e: Exception
|
||||||
end
|
end
|
||||||
)
|
CRYSTAL
|
||||||
subject.catch(s).should be_valid
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "fails if there is an invalid syntax" do
|
it "fails if there is an invalid syntax" do
|
||||||
s = Source.new %(
|
expect_issue subject, <<-CRYSTAL
|
||||||
def hello
|
def hello
|
||||||
puts "invalid"
|
puts "invalid"
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
|
# ^ error: expecting any of these tokens: ;, NEWLINE (not '=>')
|
||||||
end
|
end
|
||||||
)
|
CRYSTAL
|
||||||
subject.catch(s).should_not be_valid
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "reports rule, location and message" do
|
it "reports rule, location and message" do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue