Rename debug macro

This commit is contained in:
Michael Miller 2020-10-17 11:25:46 -06:00
parent 4974054de7
commit e6d78345c4
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD
3 changed files with 5 additions and 5 deletions

View file

@ -10,7 +10,7 @@ module Spectator
# Inserts code to produce a debug message.
# The code will only be injected when `spectator_debug` is defined (`-Dspectator_debug`).
macro debug_out(message)
macro debug(message)
{% if flag?(:spectator_debug) %}
STDERR.puts {{message}}
{% end %}

View file

@ -28,7 +28,7 @@ module Spectator
# Returns the result of the execution.
# The result will also be stored in `#result`.
def run : Result
Spectator.debug_out("Running example #{self}")
Spectator.debug("Running example #{self}")
@delegate.call(self)
raise NotImplementedError.new("#run")
end

View file

@ -36,7 +36,7 @@ module Spectator
# The newly created group is returned.
# It shouldn't be used outside of this class until a matching `#end_group` is called.
def start_group(name, source = nil) : ExampleGroup
Spectator.debug_out("Start group: #{name.inspect} @ #{source}")
Spectator.debug("Start group: #{name.inspect} @ #{source}")
ExampleGroup.new(name, source, current_group).tap do |group|
@group_stack << group
end
@ -49,7 +49,7 @@ module Spectator
# At this point, it is safe to use the group.
# All of its examples and sub-groups have been populated.
def end_group : ExampleGroup
Spectator.debug_out("End group: #{current_group}")
Spectator.debug("End group: #{current_group}")
raise "Can't pop root group" if root?
@group_stack.pop
@ -74,7 +74,7 @@ module Spectator
#
# The newly created example is returned.
def add_example(name, source, context, &block : Example, Context ->) : Example
Spectator.debug_out("Add example: #{name} @ #{source}")
Spectator.debug("Add example: #{name} @ #{source}")
delegate = ExampleContextDelegate.new(context, block)
Example.new(delegate, name, source, current_group)
# The example is added to the current group by `Example` initializer.