Skip to content

Commit

Permalink
Spec: explain why comparing against the line is needed
Browse files Browse the repository at this point in the history
Ary Borenszweig committed Nov 28, 2016

Verified

This commit was signed with the committer’s verified signature.
headius Charles Oliver Nutter
1 parent 0f2933a commit 4439f2d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/spec.cr
Original file line number Diff line number Diff line change
@@ -169,6 +169,12 @@ module Spec
spec_line = @@line
locations = @@locations

# When a method invokes `it` and only forwards line information,
# not end_line information (this can happen in code before we
# introduced the end_line feature) then running a spec by giving
# a line won't work because end_line might be located before line.
# So, we also check `line == spec_line` to somehow preserve
# backwards compatibility.
if spec_line && (line == spec_line || line <= spec_line <= end_line)
return true
end

0 comments on commit 4439f2d

Please sign in to comment.