From a2914823ce80883739782c35fa8ca8e3f2799f3c Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Fri, 26 Jul 2024 22:48:34 -0600 Subject: [PATCH] Adjust imports and do some cleanup --- src/spectator/core/configuration.cr | 2 +- src/spectator/core/context_hook.cr | 4 ++-- src/spectator/core/example.cr | 1 - src/spectator/core/example_hook.cr | 6 +++--- src/spectator/core/location_range.cr | 2 ++ src/spectator/formatters/common_text_output.cr | 1 + src/spectator/formatters/junit/test_case.cr | 1 + src/spectator/matchers/custom.cr | 2 -- src/spectator/matchers/expect.cr | 1 - src/spectator/matchers/matcher.cr | 4 ++++ src/spectator/matchers/negated.cr | 2 ++ src/spectator/matchers/should_methods.cr | 1 + 12 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/spectator/core/configuration.cr b/src/spectator/core/configuration.cr index c0365c58..c5cb1160 100644 --- a/src/spectator/core/configuration.cr +++ b/src/spectator/core/configuration.cr @@ -1,4 +1,4 @@ -require "../formatters/dots_formatter" +require "../formatters/*" require "./hooks" require "./sandbox" diff --git a/src/spectator/core/context_hook.cr b/src/spectator/core/context_hook.cr index 4a9deef1..3e881cc4 100644 --- a/src/spectator/core/context_hook.cr +++ b/src/spectator/core/context_hook.cr @@ -38,8 +38,8 @@ module Spectator::Core io << "#<" << self.class << ' ' case @position - in Position::Before then io << "before context" - in Position::After then io << "after context" + in .before? then io << "before context" + in .after? then io << "after context" end if location = @location diff --git a/src/spectator/core/example.cr b/src/spectator/core/example.cr index 4f2f0cc0..85550922 100644 --- a/src/spectator/core/example.cr +++ b/src/spectator/core/example.cr @@ -1,5 +1,4 @@ require "./item" -require "./location_range" require "./result" module Spectator::Core diff --git a/src/spectator/core/example_hook.cr b/src/spectator/core/example_hook.cr index c5f81bcf..ef541174 100644 --- a/src/spectator/core/example_hook.cr +++ b/src/spectator/core/example_hook.cr @@ -36,9 +36,9 @@ module Spectator::Core io << "#<" << self.class << ' ' case @position - in Position::Before then io << "before example" - in Position::After then io << "after example" - in Position::Around then io << "around example" + in .before? then io << "before example" + in .after? then io << "after example" + in .around? then io << "around example" end if location = @location diff --git a/src/spectator/core/location_range.cr b/src/spectator/core/location_range.cr index c9e8c6f2..8fe4211e 100644 --- a/src/spectator/core/location_range.cr +++ b/src/spectator/core/location_range.cr @@ -1,3 +1,5 @@ +require "./location" + module Spectator::Core # Information about a range in the source code. struct LocationRange diff --git a/src/spectator/formatters/common_text_output.cr b/src/spectator/formatters/common_text_output.cr index 21e67449..1f38fe2e 100644 --- a/src/spectator/formatters/common_text_output.cr +++ b/src/spectator/formatters/common_text_output.cr @@ -1,3 +1,4 @@ +require "../assertion_failed" require "../core/execution_result" require "../core/source_cache" diff --git a/src/spectator/formatters/junit/test_case.cr b/src/spectator/formatters/junit/test_case.cr index 7e47436a..fa3229a1 100644 --- a/src/spectator/formatters/junit/test_case.cr +++ b/src/spectator/formatters/junit/test_case.cr @@ -1,3 +1,4 @@ +require "../../assertion_failed" require "./xml_element" module Spectator::Formatters::JUnit diff --git a/src/spectator/matchers/custom.cr b/src/spectator/matchers/custom.cr index 451546e2..579fa0f2 100644 --- a/src/spectator/matchers/custom.cr +++ b/src/spectator/matchers/custom.cr @@ -1,5 +1,3 @@ -require "./matcher" - module Spectator::Matchers module CustomDSL macro match(*, block = false, &impl) diff --git a/src/spectator/matchers/expect.cr b/src/spectator/matchers/expect.cr index f85b7528..1163519f 100644 --- a/src/spectator/matchers/expect.cr +++ b/src/spectator/matchers/expect.cr @@ -1,4 +1,3 @@ -require "../assertion_failed" require "../core/location_range" require "./matcher" diff --git a/src/spectator/matchers/matcher.cr b/src/spectator/matchers/matcher.cr index 263f4f62..8428a2b8 100644 --- a/src/spectator/matchers/matcher.cr +++ b/src/spectator/matchers/matcher.cr @@ -1,3 +1,7 @@ +require "../assertion_failed" +require "../core/location_range" +require "../framework_error" + module Spectator::Matchers module Matcher abstract def matches?(actual_value) : Bool diff --git a/src/spectator/matchers/negated.cr b/src/spectator/matchers/negated.cr index 25794a89..5b8ffd0e 100644 --- a/src/spectator/matchers/negated.cr +++ b/src/spectator/matchers/negated.cr @@ -1,3 +1,5 @@ +require "../framework_error" + module Spectator::Matchers struct NegatedMatcher(T) def initialize(@matcher : T) diff --git a/src/spectator/matchers/should_methods.cr b/src/spectator/matchers/should_methods.cr index 78e7e5b7..1b03e9db 100644 --- a/src/spectator/matchers/should_methods.cr +++ b/src/spectator/matchers/should_methods.cr @@ -1,3 +1,4 @@ +require "../core/location_range" require "./matcher" module Spectator::Matchers