mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Extend PendingBlock from ResultBlock and rename to PendingResultBlock
This commit is contained in:
parent
7215e28d75
commit
a4042a9684
3 changed files with 25 additions and 29 deletions
|
@ -1,28 +0,0 @@
|
||||||
require "../../example"
|
|
||||||
require "./comment"
|
|
||||||
|
|
||||||
module Spectator::Formatting::Components
|
|
||||||
struct PendingBlock
|
|
||||||
private INDENT = 2
|
|
||||||
|
|
||||||
def initialize(@example : Example, @index : Int32)
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_s(io)
|
|
||||||
2.times { io << ' ' }
|
|
||||||
io << @index
|
|
||||||
io << ')'
|
|
||||||
io << ' '
|
|
||||||
io.puts @example
|
|
||||||
indent = INDENT + index_digit_count + 2
|
|
||||||
indent.times { io << ' ' }
|
|
||||||
io.puts Comment.colorize("No reason given") # TODO: Get reason from result.
|
|
||||||
indent.times { io << ' ' }
|
|
||||||
io.puts Comment.colorize(@example.location) # TODO: Pending result could be triggered from another location.
|
|
||||||
end
|
|
||||||
|
|
||||||
private def index_digit_count
|
|
||||||
(Math.log(@index.to_f + 1) / Math.log(10)).ceil.to_i
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
23
src/spectator/formatting/components/pending_result_block.cr
Normal file
23
src/spectator/formatting/components/pending_result_block.cr
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
require "../../example"
|
||||||
|
require "../../pending_result"
|
||||||
|
require "./result_block"
|
||||||
|
|
||||||
|
module Spectator::Formatting::Components
|
||||||
|
struct PendingResultBlock < ResultBlock
|
||||||
|
def initialize(index : Int32, example : Example, @result : PendingResult)
|
||||||
|
super(index, example)
|
||||||
|
end
|
||||||
|
|
||||||
|
private def subtitle
|
||||||
|
"No reason given" # TODO: Get reason from result.
|
||||||
|
end
|
||||||
|
|
||||||
|
private def subtitle_label
|
||||||
|
# TODO: Could be pending or skipped.
|
||||||
|
"Pending: ".colorize(:yellow)
|
||||||
|
end
|
||||||
|
|
||||||
|
private def content(io)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -24,7 +24,8 @@ module Spectator::Formatting
|
||||||
io.puts "Pending:"
|
io.puts "Pending:"
|
||||||
io.puts
|
io.puts
|
||||||
examples.each_with_index(1) do |example, index|
|
examples.each_with_index(1) do |example, index|
|
||||||
io.puts Components::PendingBlock.new(example, index)
|
result = example.result.as(PendingResult)
|
||||||
|
io.puts Components::PendingResultBlock.new(index, example, result)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue