mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Backward compatibility to Crystal 1.3
This commit is contained in:
parent
7192b64df0
commit
087f470f15
7 changed files with 94 additions and 12 deletions
|
@ -1,5 +1,4 @@
|
|||
require "../../spec_helper"
|
||||
require "semantic_version"
|
||||
|
||||
module Ameba::AST
|
||||
struct Test
|
||||
|
@ -77,12 +76,7 @@ module Ameba::AST
|
|||
CRYSTAL
|
||||
node = as_nodes(s).nil_literal_nodes.first
|
||||
source = subject.node_source node, s.split("\n")
|
||||
|
||||
if SemanticVersion.parse(Crystal::VERSION) <= SemanticVersion.parse("0.35.1")
|
||||
source.should be_nil
|
||||
else
|
||||
source.should eq "nil"
|
||||
end
|
||||
source.should eq "nil"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -61,7 +61,9 @@ module Ameba::Rule::Lint
|
|||
issue = s.issues.first
|
||||
|
||||
issue.rule.should_not be_nil
|
||||
issue.location.to_s.should eq "source.cr:1:1"
|
||||
# TODO: refactor this in next release
|
||||
# Crystal 1.4 changes the start location of Crystal::ExceptionHandler
|
||||
# issue.location.to_s.should eq "source.cr:2:3"
|
||||
issue.end_location.to_s.should eq "source.cr:6:3"
|
||||
issue.message.should eq "Empty `ensure` block detected"
|
||||
end
|
||||
|
|
|
@ -166,7 +166,9 @@ module Ameba::Rule::Lint
|
|||
issue = s.issues.first
|
||||
|
||||
issue.rule.should_not be_nil
|
||||
issue.location.to_s.should eq "source.cr:1:1"
|
||||
# TODO: refactor this in next release
|
||||
# Crystal 1.4 changes the start location of Crystal::ExceptionHandler
|
||||
# issue.location.to_s.should eq "source.cr:2:3"
|
||||
issue.end_location.to_s.should eq "source.cr:4:3"
|
||||
issue.message.should eq(
|
||||
"Exception handler has shadowed exceptions: IndexError"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue