mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Merge branch 'release/0.10' into specs
This commit is contained in:
parent
79d6ad93b3
commit
d612657b15
6 changed files with 57 additions and 7 deletions
|
@ -47,7 +47,7 @@ module Spectator::DSL
|
|||
|
||||
::Spectator::DSL::Builder.add_example(
|
||||
_spectator_example_name(\{{what}}),
|
||||
::Spectator::Location.new(\{{block.filename}}, \{{block.line_number}}),
|
||||
::Spectator::Location.new(\{{block.filename}}, \{{block.line_number}}, \{{block.end_line_number}}),
|
||||
new.as(::Spectator::Context),
|
||||
\%tags
|
||||
) do |example|
|
||||
|
|
|
@ -7,7 +7,9 @@ module Spectator
|
|||
|
||||
# Checks whether the example satisfies the filter.
|
||||
def includes?(example) : Bool
|
||||
@line == example.location.line
|
||||
start_line = example.location.line
|
||||
end_line = example.location.end_line
|
||||
(start_line..end_line).covers?(@line)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,11 +6,17 @@ module Spectator
|
|||
# Absolute file path.
|
||||
getter file : String
|
||||
|
||||
# Line number in the file.
|
||||
# Starting line number in the file.
|
||||
getter line : Int32
|
||||
|
||||
# Ending line number in the file.
|
||||
getter end_line : Int32
|
||||
|
||||
# Creates the location.
|
||||
def initialize(@file, @line)
|
||||
def initialize(@file, @line, end_line = nil)
|
||||
# if an end line is not provided,
|
||||
# make the end line the same as the start line
|
||||
@end_line = end_line || @line
|
||||
end
|
||||
|
||||
# Parses a location from a string.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue