mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Consistent location fields
This commit is contained in:
parent
8f3a7c0a5a
commit
39e917ce57
2 changed files with 2 additions and 8 deletions
|
@ -56,7 +56,8 @@ module Spectator
|
|||
# Creates the JSON representation of the expectation.
|
||||
def to_json(json : JSON::Builder)
|
||||
json.object do
|
||||
json.field("location") { @location.to_json(json) }
|
||||
json.field("file_path", @location.path)
|
||||
json.field("line_number", @location.line)
|
||||
json.field("satisfied", satisfied?)
|
||||
if (failed = @match_data.as?(Matchers::FailedMatchData))
|
||||
failed_to_json(failed, json)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
require "json"
|
||||
|
||||
module Spectator
|
||||
# Defines the file and line number a piece of code originated from.
|
||||
struct Location
|
||||
|
@ -64,10 +62,5 @@ module Spectator
|
|||
def to_s(io)
|
||||
io << path << ':' << line
|
||||
end
|
||||
|
||||
# Creates the JSON representation of the location.
|
||||
def to_json(json : ::JSON::Builder)
|
||||
json.string(to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue