2018-06-16 11:50:59 +00:00
|
|
|
require "../../../spec_helper"
|
2017-11-01 12:42:58 +00:00
|
|
|
|
2018-06-16 11:50:59 +00:00
|
|
|
module Ameba::Rule::Lint
|
2017-11-01 12:42:58 +00:00
|
|
|
subject = DebuggerStatement.new
|
|
|
|
|
|
|
|
describe DebuggerStatement do
|
|
|
|
it "passes if there is no debugger statement" do
|
2021-11-06 13:15:19 +00:00
|
|
|
expect_no_issues subject, <<-CRYSTAL
|
2017-11-01 12:42:58 +00:00
|
|
|
"this is not a debugger statement"
|
|
|
|
s = "debugger"
|
|
|
|
|
|
|
|
def debugger(program)
|
|
|
|
end
|
|
|
|
debugger ""
|
|
|
|
|
|
|
|
class A
|
|
|
|
def debugger
|
|
|
|
end
|
|
|
|
end
|
|
|
|
A.new.debugger
|
2021-11-06 13:15:19 +00:00
|
|
|
CRYSTAL
|
2017-11-01 12:42:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "fails if there is a debugger statement" do
|
2021-11-06 13:15:19 +00:00
|
|
|
source = expect_issue subject, <<-CRYSTAL
|
2017-11-01 12:42:58 +00:00
|
|
|
a = 2
|
|
|
|
debugger
|
2021-11-06 13:15:19 +00:00
|
|
|
# ^^^^^^ error: Possible forgotten debugger statement detected
|
2017-11-01 12:42:58 +00:00
|
|
|
a = a + 1
|
2021-11-06 13:15:19 +00:00
|
|
|
CRYSTAL
|
|
|
|
|
|
|
|
expect_no_corrections source
|
2017-11-01 12:42:58 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|