2021-01-17 15:41:34 +00:00
|
|
|
require "../../../spec_helper"
|
|
|
|
|
|
|
|
module Ameba::Rule::Lint
|
|
|
|
subject = DuplicatedRequire.new
|
|
|
|
|
|
|
|
describe DuplicatedRequire do
|
|
|
|
it "passes if there are no duplicated requires" do
|
2021-11-06 13:15:19 +00:00
|
|
|
expect_no_issues subject, <<-CRYSTAL
|
2021-01-17 15:41:34 +00:00
|
|
|
require "math"
|
|
|
|
require "big"
|
|
|
|
require "big/big_decimal"
|
2021-11-06 13:15:19 +00:00
|
|
|
CRYSTAL
|
2021-01-17 15:41:34 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "reports if there are a duplicated requires" do
|
2021-11-06 13:15:19 +00:00
|
|
|
source = expect_issue subject, <<-CRYSTAL
|
2021-01-17 15:41:34 +00:00
|
|
|
require "big"
|
|
|
|
require "math"
|
|
|
|
require "big"
|
2022-12-21 15:23:36 +00:00
|
|
|
# ^^^^^^^^^^^ error: Duplicated require of `big`
|
2021-11-06 13:15:19 +00:00
|
|
|
CRYSTAL
|
|
|
|
|
|
|
|
expect_no_corrections source
|
2021-01-17 15:41:34 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|