mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add placeholders for profile functionality
This commit is contained in:
parent
2d88097c04
commit
35b887f8f0
9 changed files with 50 additions and 12 deletions
|
@ -14,7 +14,8 @@ module Spectator::Formatting
|
|||
|
||||
# Called when a test suite finishes.
|
||||
# The results from the entire suite are provided.
|
||||
abstract def end_suite(report : Report)
|
||||
# The *profile* flag is set to true when profiling results should be generated.
|
||||
abstract def end_suite(report : Report, profile : Bool)
|
||||
|
||||
# Called before a test starts.
|
||||
abstract def start_example(example : Example)
|
||||
|
|
|
@ -20,10 +20,12 @@ module Spectator::Formatting
|
|||
|
||||
# Called when a test suite finishes.
|
||||
# The results from the entire suite are provided.
|
||||
def end_suite(report : Report)
|
||||
# The *profile* flag is set to true when profiling results should be generated.
|
||||
def end_suite(report : Report, profile : Bool)
|
||||
@json.end_array # examples
|
||||
totals(report)
|
||||
timing(report)
|
||||
profile(report) if profile
|
||||
@json.field("result", report.failed? ? "fail" : "success")
|
||||
@json.end_object
|
||||
end
|
||||
|
@ -62,5 +64,10 @@ module Spectator::Formatting
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Adds the profile information to the document.
|
||||
private def profile(report)
|
||||
raise NotImplementedError.new("profile")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,8 @@ module Spectator::Formatting
|
|||
|
||||
# Called when a test suite finishes.
|
||||
# The results from the entire suite are provided.
|
||||
def end_suite(report : Report)
|
||||
# The *profile* flag does nothing for this formatter.
|
||||
def end_suite(report : Report, profile : Bool)
|
||||
test_suites_block(report)
|
||||
@xml.end_document
|
||||
@xml.flush
|
||||
|
|
|
@ -9,7 +9,7 @@ module Spectator::Formatting
|
|||
|
||||
# Called when a test suite finishes.
|
||||
# The results from the entire suite are provided.
|
||||
def end_suite(report : Report)
|
||||
def end_suite(report : Report, profile : Bool)
|
||||
# ... crickets ...
|
||||
end
|
||||
|
||||
|
|
|
@ -9,12 +9,14 @@ module Spectator::Formatting
|
|||
# Produces the summary of test suite from a report.
|
||||
# A block describing each failure is displayed.
|
||||
# At the end, the totals and runtime are printed.
|
||||
def end_suite(report)
|
||||
# The *profile* flag is set to true when profiling results should be generated.
|
||||
def end_suite(report, profile : Bool)
|
||||
if report.example_count > 0
|
||||
@io.puts if is_a?(DotsFormatter)
|
||||
@io.puts
|
||||
end
|
||||
failures(report.failures) if report.failed_count > 0
|
||||
profile(report) if profile
|
||||
stats(report)
|
||||
remaining(report) if report.remaining?
|
||||
if report.failed?
|
||||
|
@ -36,6 +38,11 @@ module Spectator::Formatting
|
|||
end
|
||||
end
|
||||
|
||||
# Produces the profiling section of the summary.
|
||||
private def profile(report)
|
||||
raise NotImplementedError.new("profile")
|
||||
end
|
||||
|
||||
# Produces the statistical section of the summary.
|
||||
# This contains how long the suite took to run
|
||||
# and the counts for the results (total, failures, errors, and pending).
|
||||
|
|
|
@ -16,8 +16,9 @@ module Spectator::Formatting
|
|||
|
||||
# Called when a test suite finishes.
|
||||
# The results from the entire suite are provided.
|
||||
def end_suite(report : Report)
|
||||
def end_suite(report : Report, profile : Bool)
|
||||
@io.puts "Bail out!" if report.remaining?
|
||||
profile(report) if profile
|
||||
end
|
||||
|
||||
# Called before a test starts.
|
||||
|
@ -30,5 +31,10 @@ module Spectator::Formatting
|
|||
@io.puts TAPTestLine.new(@index, result)
|
||||
@index += 1
|
||||
end
|
||||
|
||||
# Generates profiling information for the report.
|
||||
private def profile(report)
|
||||
raise NotImplementedError.new("profile")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ module Spectator
|
|||
# Generate a report and pass it along to the formatter.
|
||||
remaining = @suite.size - results.size
|
||||
report = Report.new(results, elapsed, remaining, @config.fail_blank?)
|
||||
@config.each_formatter(&.end_suite(report))
|
||||
@config.each_formatter(&.end_suite(report, false)) # TODO: Profile flag.
|
||||
|
||||
!report.failed?
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue