diff --git a/src/spectator/internals/sample_values.cr b/src/spectator/test_values.cr similarity index 89% rename from src/spectator/internals/sample_values.cr rename to src/spectator/test_values.cr index 8cab714..74fc923 100644 --- a/src/spectator/internals/sample_values.cr +++ b/src/spectator/test_values.cr @@ -1,10 +1,10 @@ require "./value_wrapper" -module Spectator::Internals +module Spectator # Collection of test values supplied to examples. # Each value is labeled by a symbol that the example knows. # The values also come with a name that can be given to humans. - struct SampleValues + struct TestValues # Creates an empty set of sample values. def self.empty new({} of Symbol => Entry) @@ -17,9 +17,9 @@ module Spectator::Internals # Adds a new value by duplicating the current set and adding to it. # The new sample values with the additional value is returned. # The original set of sample values is not modified. - def add(id : Symbol, name : String, value : T) : SampleValues forall T + def add(id : Symbol, name : String, value : T) : TestValues forall T wrapper = TypedValueWrapper(T).new(value) - SampleValues.new(@values.merge({ + TestValues.new(@values.merge({ id => Entry.new(name, wrapper), })) end @@ -58,7 +58,6 @@ module Spectator::Internals end # This must be after `Entry` is defined. - # Could be a Cyrstal compiler bug? include Enumerable(Entry) end end diff --git a/src/spectator/internals/typed_value_wrapper.cr b/src/spectator/typed_value_wrapper.cr similarity index 94% rename from src/spectator/internals/typed_value_wrapper.cr rename to src/spectator/typed_value_wrapper.cr index 39e06cf..8131d82 100644 --- a/src/spectator/internals/typed_value_wrapper.cr +++ b/src/spectator/typed_value_wrapper.cr @@ -1,6 +1,6 @@ require "./value_wrapper" -module Spectator::Internals +module Spectator # Implementation of a value wrapper for a specific type. # Instances of this class should be created to wrap values. # Then the wrapper should be stored as a `ValueWrapper` diff --git a/src/spectator/internals/value_wrapper.cr b/src/spectator/value_wrapper.cr similarity index 69% rename from src/spectator/internals/value_wrapper.cr rename to src/spectator/value_wrapper.cr index 4c0183e..170951d 100644 --- a/src/spectator/internals/value_wrapper.cr +++ b/src/spectator/value_wrapper.cr @@ -1,9 +1,7 @@ -module Spectator::Internals +module Spectator # Base class for proxying test values to examples. # This abstraction is required for inferring types. # The DSL makes heavy use of this to defer types. abstract class ValueWrapper - # Retrieves the underlying value. - abstract def value end end