mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add dry-run to config
This commit is contained in:
parent
46e3246c5c
commit
435f971c87
3 changed files with 24 additions and 1 deletions
|
@ -16,6 +16,7 @@ module Spectator
|
||||||
parser.on("-v", "--verbose", "Verbose output using document formatter") { builder.formatter = Formatting::DocumentFormatter.new }
|
parser.on("-v", "--verbose", "Verbose output using document formatter") { builder.formatter = Formatting::DocumentFormatter.new }
|
||||||
parser.on("-f", "--fail-fast", "Stop testing on first failure") { builder.fail_fast }
|
parser.on("-f", "--fail-fast", "Stop testing on first failure") { builder.fail_fast }
|
||||||
parser.on("-b", "--fail-blank", "Fail if there are no examples") { builder.fail_blank }
|
parser.on("-b", "--fail-blank", "Fail if there are no examples") { builder.fail_blank }
|
||||||
|
parser.on("-d", "--dry-run", "Don't run any tests, output what would have run") { builder.dry_run }
|
||||||
parser.on("-h", "--help", "Show this help") { puts parser; exit }
|
parser.on("-h", "--help", "Show this help") { puts parser; exit }
|
||||||
parser.on("-e", "--example STRING", "Run examples whose full nested names include STRING") { |pattern| raise NotImplementedError.new("-e") }
|
parser.on("-e", "--example STRING", "Run examples whose full nested names include STRING") { |pattern| raise NotImplementedError.new("-e") }
|
||||||
parser.on("-l", "--line LINE", "Run examples whose line matches LINE") { |line| raise NotImplementedError.new("-l") }
|
parser.on("-l", "--line LINE", "Run examples whose line matches LINE") { |line| raise NotImplementedError.new("-l") }
|
||||||
|
|
|
@ -10,11 +10,16 @@ module Spectator
|
||||||
# Indicates whether the test should fail if there are no examples.
|
# Indicates whether the test should fail if there are no examples.
|
||||||
getter? fail_blank : Bool
|
getter? fail_blank : Bool
|
||||||
|
|
||||||
|
# Indicates whether the test should be done as a dry-run.
|
||||||
|
# Examples won't run, but the output will show that they did.
|
||||||
|
getter? dry_run : Bool
|
||||||
|
|
||||||
# Creates a new configuration.
|
# Creates a new configuration.
|
||||||
def initialize(builder)
|
def initialize(builder)
|
||||||
@formatter = builder.formatter
|
@formatter = builder.formatter
|
||||||
@fail_fast = builder.fail_fast?
|
@fail_fast = builder.fail_fast?
|
||||||
@fail_blank = builder.fail_blank?
|
@fail_blank = builder.fail_blank?
|
||||||
|
@dry_run = builder.dry_run?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,7 @@ module Spectator
|
||||||
@formatter : Formatting::Formatter? = nil
|
@formatter : Formatting::Formatter? = nil
|
||||||
@fail_fast = false
|
@fail_fast = false
|
||||||
@fail_blank = false
|
@fail_blank = false
|
||||||
|
@dry_run = false
|
||||||
|
|
||||||
# Sets the formatter to use for reporting test progress and results.
|
# Sets the formatter to use for reporting test progress and results.
|
||||||
def formatter=(formatter : Formatting::Formatter)
|
def formatter=(formatter : Formatting::Formatter)
|
||||||
|
@ -50,7 +51,7 @@ module Spectator
|
||||||
self.fail_blank = true
|
self.fail_blank = true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sets teh fail-blank mode.
|
# Enables or disables fail-blank mode.
|
||||||
def fail_blank=(flag)
|
def fail_blank=(flag)
|
||||||
@fail_blank = flag
|
@fail_blank = flag
|
||||||
end
|
end
|
||||||
|
@ -61,6 +62,22 @@ module Spectator
|
||||||
@fail_blank
|
@fail_blank
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Enables dry-run mode.
|
||||||
|
def dry_run
|
||||||
|
self.dry_run = true
|
||||||
|
end
|
||||||
|
|
||||||
|
# Enables or disables dry-run mode.
|
||||||
|
def dry_run=(flag)
|
||||||
|
@dry_run = flag
|
||||||
|
end
|
||||||
|
|
||||||
|
# Indicates whether dry-run mode is enabled.
|
||||||
|
# In this mode, no tests are run, but output acts like they were.
|
||||||
|
def dry_run?
|
||||||
|
@dry_run
|
||||||
|
end
|
||||||
|
|
||||||
# Creates a configuration.
|
# Creates a configuration.
|
||||||
def build : Config
|
def build : Config
|
||||||
Config.new(self)
|
Config.new(self)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue