Improve forward compatibility with future crystal version

https://github.com/crystal-ameba/ameba/issues/168#issuecomment-722051876
This commit is contained in:
Vitalii Elenhaupt 2020-11-05 10:23:25 +02:00
parent de3f16a9dc
commit 5b4b1e817d
No known key found for this signature in database
GPG key ID: CD0BF17825928BC0

View file

@ -1,4 +1,5 @@
require "../../spec_helper"
require "semantic_version"
module Ameba::AST
struct Test
@ -76,7 +77,12 @@ module Ameba::AST
)
node = as_nodes(s).nil_literal_nodes.first
source = subject.node_source node, s.split("\n")
source.should be_nil
if SemanticVersion.parse(Crystal::VERSION) <= SemanticVersion.parse("0.35.1")
source.should be_nil
else
source.should eq %w(nil)
end
end
end