shard-spectator/src/spectator/example_group_iteration.cr

26 lines
1.0 KiB
Crystal
Raw Normal View History

require "./example_group"
2021-07-17 20:01:27 +00:00
require "./label"
require "./location"
require "./metadata"
module Spectator
2021-07-17 20:01:27 +00:00
# Collection of examples and sub-groups for a single iteration of an iterative example group.
class ExampleGroupIteration(T) < ExampleGroup
2021-07-17 20:01:27 +00:00
# Item for this iteration of the example groups.
2021-07-17 18:07:04 +00:00
getter item : T
2021-07-17 20:01:27 +00:00
# Creates the example group iteration.
# The element for the current iteration is provided by *item*.
# The *name* describes the purpose of the group.
# It can be a `Symbol` to describe a type.
# This is typically a stringified form of *item*.
# The *location* tracks where the group exists in source code.
# This group will be assigned to the parent *group* if it is provided.
# A set of *metadata* can be used for filtering and modifying example behavior.
def initialize(@item : T, name : Label = nil, location : Location? = nil,
2022-11-30 06:22:42 +00:00
group : ExampleGroup? = nil, metadata : Metadata? = nil)
super(name, location, group, metadata)
end
end
end